]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ICAP bug: request satisfaction mode was not working. The presence of
authorwessels <>
Thu, 22 Jun 2006 04:37:49 +0000 (04:37 +0000)
committerwessels <>
Thu, 22 Jun 2006 04:37:49 +0000 (04:37 +0000)
an HTTP body in the ICAP reply was assumed to be an HTTP request body,
rather than possibly a response body.

src/ICAP/ICAPClientReqmodPrecache.cc
src/client_side_request.cc

index 0b4507c6dbe8908b06f9c2b615fdd11783fc3acc..42853b6a7108fe8a94825b5bcae0146cd4ff09da 100644 (file)
@@ -148,10 +148,20 @@ void ICAPClientReqmodPrecache::noteSourceProgress(MsgPipe *p)
     //tell ClientHttpRequest to store a fresh portion of the adapted response
 
     if (p->data->body->hasContent()) {
+        /*
+         * NOTE: req will be NULL if this is a "request satisfaction"
+         * ICAP reply.  In other words, the ICAP REQMOD reply may
+         * contain an HTTP response, in which case we'll have a body, but
+         * adapted->data->header will be an HttpReply, not an HttpRequest.
+         */
         HttpRequest *req = dynamic_cast<HttpRequest*>(adapted->data->header);
-        assert(req);
-        debugs(32,3,HERE << "notifying body_reader, contentSize() = " << p->data->body->contentSize());
-        req->body_reader->notify(p->data->body->contentSize());
+
+        if (req) {
+            debugs(32,3,HERE << "notifying body_reader, contentSize() = " << p->data->body->contentSize());
+            req->body_reader->notify(p->data->body->contentSize());
+        } else {
+            http->takeAdaptedBody(adapted->data->body);
+        }
     }
 }
 
index 5a2f1a9cc3044f5043ffd4d80366b0e743465263..019313513481c6a5f49a049a98e6eb98986ebd72 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.70 2006/06/05 18:57:08 serassio Exp $
+ * $Id: client_side_request.cc,v 1.71 2006/06/21 22:37:49 wessels Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -1252,6 +1252,9 @@ ClientHttpRequest::takeAdaptedBody(MemBuf *buf)
         storeEntry()->write(StoreIOBuffer(buf, request_satisfaction_offset));
         request_satisfaction_offset += buf->contentSize();
         buf->consume(buf->contentSize()); // consume everything written
+    } else {
+        debug(85,0)("Unexpected call to takeAdaptedBody when "
+                    "not in request_satisfaction_mode");
     }
 }