("nsHTTPResponseListener::ParseStatusLine [this=%x].\taLength=%d\n",
("nsHTTPServerListener::ParseStatusLine [this=%x].\taLength=%d\n",
nsresult nsHTTPResponseListener::ParseStatusLine(nsIBufferInputStream* in,                                                  PRUint32 aLength,                                                 PRUint32 *aBytesRead){  nsresult rv = NS_OK;  PRBool bFoundString = PR_FALSE;  PRUint32 offsetOfEnd, totalBytesToRead, actualBytesRead;  PR_LOG(gHTTPLog, PR_LOG_ALWAYS,          ("nsHTTPResponseListener::ParseStatusLine [this=%x].\taLength=%d\n",           this, aLength));  *aBytesRead = 0;  if (kMAX_HEADER_SIZE < mHeaderBuffer.Length()) {    // This server is yanking our chain...    return NS_ERROR_FAILURE;  }  // Look for the LF which ends the Status-Line.  // n.b. Search looks at all pending data not just the first aLength bytes  rv = in->Search("\n", PR_FALSE, &bFoundString, &offsetOfEnd);  if (NS_FAILED(rv)) return rv;  if (bFoundString && offsetOfEnd >= aLength) bFoundString = PR_FALSE;  if (!bFoundString) {    //    // This is a partial header...  Read the entire buffer and wait for    // more data...    //    totalBytesToRead = aLength;  } else {    // Do not forget to include the LF character in the read...    totalBytesToRead = offsetOfEnd+1;  }  rv = in->ReadSegments(nsWriteToString,                         (void*)&mHeaderBuffer,                         totalBytesToRead,                         &actualBytesRead);  if (NS_FAILED(rv)) return rv;  *aBytesRead += actualBytesRead;  // Wait for more data to arrive before processing the header...  if (!bFoundString) return NS_OK;  PR_LOG(gHTTPLog, PR_LOG_ALWAYS,          ("\tParseStatusLine [this=%x].\tGot Status-Line:%s\n"         , this, mHeaderBuffer.GetBuffer()));  //  // Replace all LWS with single SP characters.  Also remove the CRLF  // characters...  //  mHeaderBuffer.CompressSet(" \t", ' ');  mHeaderBuffer.StripChars("\r\n");  rv = mResponse->ParseStatusLine(mHeaderBuffer);  if (NS_SUCCEEDED(rv)) {    HTTPVersion ver;    rv = mResponse->GetServerVersion(&ver);    if (HTTP_ZERO_NINE == ver) {      //      // This is a HTTP/0.9 response...      // Pretend that the headers have been consumed.      //      PR_LOG(gHTTPLog, PR_LOG_ALWAYS,              ("\tParseStatusLine [this=%x]. HTTP/0.9 Server Response!"              " Hold onto you seats!\n", this));      mResponse->SetStatus(200);      // XXX: There will be no Content-Type or Content-Length headers!      mHeadersDone = PR_TRUE;    }  }  mFirstLineParsed = PR_TRUE;  return rv;}