Bug 632061 - Firefox 4 does not always properly handle HTTP/0.9 responses r=bz a=blocking-2.0

--HG--
extra : rebase_source : 8185a73da91b5327d5826d8945a044ac87fd41be
This commit is contained in:
Patrick McManus 2011-02-08 18:26:33 -05:00
parent 970b70caff
commit ae544d7e57

View File

@ -688,6 +688,9 @@ nsHttpTransaction::LocateHttpStart(char *buf, PRUint32 len,
static const char HTTPHeader[] = "HTTP/1.";
static const PRInt32 HTTPHeaderLen = sizeof(HTTPHeader) - 1;
if (aAllowPartialMatch && (len < HTTPHeaderLen))
return (PL_strncasecmp(buf, HTTPHeader, len) == 0) ? buf : nsnull;
// mLineBuf can contain partial match from previous search
if (!mLineBuf.IsEmpty()) {
NS_ASSERTION(mLineBuf.Length() < HTTPHeaderLen, "ouch");
@ -714,13 +717,9 @@ nsHttpTransaction::LocateHttpStart(char *buf, PRUint32 len,
if (PL_strncasecmp(buf, HTTPHeader, PR_MIN(len, HTTPHeaderLen)) == 0) {
if (len < HTTPHeaderLen) {
// partial HTTPHeader sequence found
if (aAllowPartialMatch) {
return buf;
} else {
// save partial match to mLineBuf
mLineBuf.Assign(buf, len);
return 0;
}
// save partial match to mLineBuf
mLineBuf.Assign(buf, len);
return 0;
}
// whole HTTPHeader sequence found
@ -828,7 +827,7 @@ nsHttpTransaction::ParseHead(char *buf,
if (!mConnection || !mConnection->LastTransactionExpectedNoContent()) {
// tolerate only minor junk before the status line
mHttpResponseMatched = PR_TRUE;
char *p = LocateHttpStart(buf, PR_MIN(count, 8), PR_TRUE);
char *p = LocateHttpStart(buf, PR_MIN(count, 11), PR_TRUE);
if (!p) {
// Treat any 0.9 style response of a put as a failure.
if (mRequestHead->Method() == nsHttp::Put)