]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 1754: BodyReader was reading too much data from the socket buffer.
authoradrian <>
Thu, 7 Sep 2006 07:00:03 +0000 (07:00 +0000)
committeradrian <>
Thu, 7 Sep 2006 07:00:03 +0000 (07:00 +0000)
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.

src/BodyReader.cc

index da85a56b446c43d30999438c37e24098176cbf01..6848a5ce3bb717bf7f2862da84b7238b964e061d 100644 (file)
@@ -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");