Bug 666502. DONTBUILD. Document how we make sure HTTP headers have been read by time OnStartRequest called. r=bz

This commit is contained in:
Jason Duell 2011-06-23 14:41:45 -07:00
parent 78bbcf1909
commit f6ae5087c9
2 changed files with 6 additions and 1 deletions

View File

@ -4005,6 +4005,7 @@ nsHttpChannel::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
// don't enter this block if we're reading from the cache...
if (NS_SUCCEEDED(mStatus) && !mCachePump && mTransaction) {
// mTransactionPump doesn't hit OnInputStreamReady and call this until
// all of the response headers have been acquired, so we can take ownership
// of them from the transaction.
mResponseHead = mTransaction->TakeResponseHead();

View File

@ -539,8 +539,12 @@ nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream,
NS_ASSERTION(*countWritten > 0, "bad writer");
trans->mReceivedData = PR_TRUE;
// now let the transaction "play" with the buffer. it is free to modify
// Let the transaction "play" with the buffer. It is free to modify
// the contents of the buffer and/or modify countWritten.
// - Bytes in HTTP headers don't count towards countWritten, so the input
// side of pipe (aka nsHttpChannel's mTransactionPump) won't hit
// OnInputStreamReady until all headers have been parsed.
//
rv = trans->ProcessData(buf, *countWritten, countWritten);
if (NS_FAILED(rv))
trans->Close(rv);