From: adrian <> Date: Thu, 7 Sep 2006 07:00:03 +0000 (+0000) Subject: Bug 1754: BodyReader was reading too much data from the socket buffer. X-Git-Tag: SQUID_3_0_PRE5~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf2d41db272e25f0fb06903a3e8dcd7a13306830;p=thirdparty%2Fsquid.git Bug 1754: BodyReader was reading too much data from the socket buffer. Fix the BodyReader read routine to only empty enough data to satisfy the given Content-Length; rather than emptying the buffer entirely. Some clients have a habit of stuffing a \r\n at the end of a POST body and this was being (over)read and hitting an assertion. --- diff --git a/src/BodyReader.cc b/src/BodyReader.cc index da85a56b44..6848a5ce3b 100644 --- a/src/BodyReader.cc +++ b/src/BodyReader.cc @@ -52,9 +52,14 @@ BodyReader::read(CBCB *callback, void *cbdata) debugs(32,3,HERE << this << " " << "data=" << read_func_data); size_t size = theBuf.potentialSpaceSize(); + debug(32, 3) ("BodyReader::read: available: %d, size %d, _remaining: %d\n", _available, size, _remaining); + if (size > _available) size = _available; + if (size > _remaining) + size = _remaining; + if (size > 0) { debugs(32,3,HERE << this << " " << "calling read_func for " << size << " bytes");