From: wessels <> Date: Thu, 19 Oct 2006 07:39:40 +0000 (+0000) Subject: bugfix: In clientProcessRequest(), the call to connNoteUseOfBuffer() was X-Git-Tag: SQUID_3_0_PRE5~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5fa72193031f44d588f1fa9c6b72138cda8206c;p=thirdparty%2Fsquid.git bugfix: In clientProcessRequest(), the call to connNoteUseOfBuffer() was moved from the beginning to the end of the function. This broke request body processing because "conn->in.notYetUsed" was wrong at the time of BodyReader creation. As a workaround we now subtract http->req_sz from conn->in.notYetUsed when telling the BodyReader how much data there is on the socket. --- diff --git a/src/client_side.cc b/src/client_side.cc index fbd401966e..19c9d5a779 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.742 2006/10/02 02:22:22 adrian Exp $ + * $Id: client_side.cc,v 1.743 2006/10/19 01:39:40 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2067,7 +2067,7 @@ connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount) { assert(byteCount > 0 && byteCount <= conn->in.notYetUsed); conn->in.notYetUsed -= byteCount; - debug(33, 5) ("conn->in.notYetUsed = %u\n", (unsigned) conn->in.notYetUsed); + debugs(33, 5, HERE << "conn->in.notYetUsed = " << conn->in.notYetUsed); /* * If there is still data that will be used, * move it to the beginning. @@ -2254,7 +2254,13 @@ clientProcessRequest(ConnStateData::Pointer &conn, HttpParser *hp, ClientSocketC NULL, conn.getRaw()); conn->body_reader(request->body_reader); - request->body_reader->notify(conn->in.notYetUsed); + /* + * NOTE: We haven't called connNoteUseOfBuffer() yet. It gets + * done at finish: below. So here we have to subtract off + * req_sz from notYetUsed, or else the BodyReader thinks it + * has more data than it really does, and will get confused. + */ + request->body_reader->notify(conn->in.notYetUsed - http->req_sz); if (request->body_reader->remaining()) conn->readSomeData();