r=gagan. 17647. we digesting content-type comments as legitimate header values. now we're not

git-svn-id: svn://10.0.0.236/trunk@57714 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
valeski%netscape.com
2000-01-13 23:22:25 +00:00
parent 47835cb693
commit 8cb3795a6a

View File

@@ -373,28 +373,32 @@ nsresult nsHTTPResponse::ProcessHeader(nsIAtom* aHeader, nsCString& aValue)
nsCAutoString buffer;
PRInt32 semicolon;
// Set the content-type in the HTTPChannel...
semicolon = aValue.FindChar(';');
if (kNotFound != semicolon) {
aValue.Left(buffer, semicolon);
SetContentType(buffer.GetBuffer());
// we don't care about comments
PRInt32 parenLoc = aValue.FindChar('(');
if (parenLoc > -1) {
aValue.Truncate(parenLoc);
aValue.Trim(" ", PR_FALSE);
}
// Does the Content-Type contain a charset attribute?
aValue.Mid(buffer, semicolon+1, -1);
buffer.Trim(" ");
if (0 == buffer.Find("charset=", PR_TRUE)) {
//
// Set the charset in the HTTPChannel...
//
// XXX: Currently, the charset is *everything* past the "charset="
// This includes comments :-(
//
buffer.Cut(0, 8);
SetCharset(buffer.GetBuffer());
if (!aValue.IsEmpty()) {
// Set the content-type in the HTTPChannel...
semicolon = aValue.FindChar(';');
if (kNotFound != semicolon) {
aValue.Left(buffer, semicolon);
SetContentType(buffer.GetBuffer());
// Does the Content-Type contain a charset attribute?
aValue.Mid(buffer, semicolon+1, -1);
buffer.Trim(" ");
if (0 == buffer.Find("charset=", PR_TRUE)) {
// Set the charset in the HTTPChannel...
buffer.Cut(0, 8);
SetCharset(buffer.GetBuffer());
}
}
else {
SetContentType(aValue.GetBuffer());
}
}
else {
SetContentType(aValue.GetBuffer());
}
}
//