]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ICAPClientRespmodPrecache::noteSourceStart() should know whether
authorwessels <>
Wed, 11 Jan 2006 00:22:06 +0000 (00:22 +0000)
committerwessels <>
Wed, 11 Jan 2006 00:22:06 +0000 (00:22 +0000)
or not to expect an HTTP body and call the appropriate next note
function.

src/ICAP/ICAPClientRespmodPrecache.cc

index 50e2ffac963ce8621dc019c2b154796f1c3c423c..f3d8518339cb36f8a3ee4b879d16e03e42633485 100644 (file)
@@ -127,6 +127,10 @@ void ICAPClientRespmodPrecache::noteSourceStart(MsgPipe *p)
 {
     debug(93,5)("ICAPClientRespmodPrecache::noteSourceStart() called\n");
 
+    /*
+     * May want to assert that adapted != NULL here
+     */
+
     HttpReply *reply = dynamic_cast<HttpReply*>(adapted->data->header);
     /*
      * The ICAP reply MUST have a new HTTP reply header, or else
@@ -134,12 +138,28 @@ void ICAPClientRespmodPrecache::noteSourceStart(MsgPipe *p)
      * be handled prior to this point.
      */
     assert(reply); // check that ICAP xaction created the right object
-    httpState->takeAdaptedHeaders(reply);
-
     assert(reply == adapted->data->header);
+
+    /*
+     * Examine the HTTP reply headers to find out if there is an associated
+     * body.  We should probably check the ICAP Encapsulated header values
+     * as well.
+     */
+    ssize_t dummy;
+    bool expect_body = reply->expectingBody(virgin->data->cause->method, dummy);
+
+    /*
+     * When we call takeAdaptedHeaders() we give up any control over
+     * adapted->data->header
+     */
+    httpState->takeAdaptedHeaders(reply);
     adapted->data->header = NULL;
+    reply = NULL;
 
-    noteSourceProgress(p);
+    if (expect_body)
+        noteSourceProgress(p);
+    else
+        noteSourceFinish(p);
 }
 
 // ICAP client sends more data