]> 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>
Thu, 6 Oct 2011 08:29:03 +0000 (11:29 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Thu, 6 Oct 2011 08:29:03 +0000 (11:29 +0300)
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 2b918fa31d11af33d87046146aacc26d37e0a807..4c2666a4514754bc14516e94b4ec8f90370c92af 100644 (file)
@@ -3938,6 +3938,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()
index ba11aee90afc25651bf42fc5b1c5ddf82d4e0052..e895024f0442ad12f1a61e0e118572d9f02d37a5 100644 (file)
@@ -262,6 +262,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 805729ddb1e028d64e077969f42dd26471775a8f..f4da4d49b69661e2fdeebb3ed49bf8ffe650362a 100644 (file)
@@ -1791,6 +1791,7 @@ ClientHttpRequest::handleAdaptationFailure(int errDetail, bool bypassable)
 
     request->detailError(ERR_ICAP_FAILURE, errDetail);
     c->flags.readMore = true;
+    c->expectNoForwarding();
     node = (clientStreamNode *)client_stream.tail->data;
     clientStreamRead(node, this, node->readBuffer);
 }