Bug 1230353: P1. Ensure type and subtype of MIME are lowercase. r=bz

As per RFC 2616 section 3.7, which states "The type, subtype, and parameter attribute names are case-insensitive". So ensure the type and subtype are always lower-case as all our comparisons assume that they are.
This commit is contained in:
Jean-Yves Avenard 2015-12-03 18:58:58 +11:00
parent b2545f9af0
commit 5800cccc88
2 changed files with 10 additions and 4 deletions

View File

@ -17,10 +17,7 @@ public:
~nsContentTypeParser();
nsresult GetParameter(const char* aParameterName, nsAString& aResult);
nsresult GetType(nsAString& aResult)
{
return GetParameter(nullptr, aResult);
}
nsresult GetType(nsAString& aResult);
private:
NS_ConvertUTF16toUTF8 mString;

View File

@ -6057,6 +6057,15 @@ nsContentTypeParser::GetParameter(const char* aParameterName, nsAString& aResult
aResult);
}
nsresult
nsContentTypeParser::GetType(nsAString& aResult)
{
nsresult rv = GetParameter(nullptr, aResult);
NS_ENSURE_SUCCESS(rv, rv);
nsContentUtils::ASCIIToLower(aResult);
return NS_OK;
}
/* static */
bool