]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3190: Large HTTP POST stuck after early ICAP 400 error response
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Tue, 11 Oct 2011 02:04:19 +0000 (20:04 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 11 Oct 2011 02:04:19 +0000 (20:04 -0600)
When an ICAP REQMOD service responds with an error to
(or the REQMOD transaction aborts while processing) a large HTTP
request, the HTTP request may get stuck because the request body
buffer gets full and nobody consumes the no-longer-needed content.

The ICAP code quits but leaves the body buffer intact in case the
client-side code wants to bypass the error. After that, nobody consumes
the request body because the buggy client side does not inform the body
pipe that there will be no other consumers, which would have triggered
a noteBodyConsumerAborted() callback and enable auto-consumption or closed
the client connection.

This is a Measurement Factory project

src/client_side.cc
src/client_side.h
src/client_side_request.cc

index e9d2a4f2e6db71defd52cfc8f6c757120e45840a..146f6c033148c2997a9d728f68a42b41b137b083 100644 (file)
@@ -3827,6 +3827,14 @@ ConnStateData::startClosing(const char *reason)
     bodyPipe->enableAutoConsumption();
 }
 
+void
+ConnStateData::expectNoForwarding() {
+    if (bodyPipe != NULL) {
+        debugs(33, 4, HERE << "no consumer for virgin body " << bodyPipe->status());
+        bodyPipe->expectNoConsumption();
+    }
+}
+
 // initialize dechunking state
 void
 ConnStateData::startDechunkingRequest(HttpParser *hp)
index 899541e59e090b2616f233f4c34ab8faaf14d92c..d85d71bbd80b2ab81c93b7139a0ca14230650c26 100644 (file)
@@ -216,6 +216,7 @@ public:
 
     bool closing() const;
     void startClosing(const char *reason);
+    void expectNoForwarding(); ///< cleans up virgin request [body] forwarding state
 
     BodyPipe::Pointer expectRequestBody(int64_t size);
     virtual void noteMoreBodySpaceAvailable(BodyPipe::Pointer);
index e4c0d35e507364e69f5eb6b6bbd9b2105102a031..a690743f66e7a9cc73bf94e78804f06cdbaaa514 100644 (file)
@@ -1559,6 +1559,7 @@ ClientHttpRequest::handleAdaptationFailure(bool bypassable)
                                 (c != NULL && c->auth_user_request ?
                                  c->auth_user_request : request->auth_user_request));
     c->flags.readMoreRequests = true;
+    c->expectNoForwarding();
     node = (clientStreamNode *)client_stream.tail->data;
     clientStreamRead(node, this, node->readBuffer);
 }