]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
HEAD fixes (damn I hate HEAD)
authorwessels <>
Wed, 16 Sep 1998 04:05:09 +0000 (04:05 +0000)
committerwessels <>
Wed, 16 Sep 1998 04:05:09 +0000 (04:05 +0000)
on the server-side, HEAD transfers are always done soon as we make it
to the end of the reply headers

on the client-side, we can't do IMS for HEAD.  Always return cache HITS,
never a refresh.

httpMaybeRemovePublic() gets bastardized already.  Also
make it remove HEAD objects for new GET requests.

src/http.cc

index b0860e98de1b1c04eede4032a58c7cb1ec704279..9fa9ad54ddbef1bd73fa055a2df61afb45b388b8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.320 1998/09/15 20:36:15 wessels Exp $
+ * $Id: http.cc,v 1.321 1998/09/15 22:05:09 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -161,10 +161,18 @@ httpMaybeRemovePublic(StoreEntry * e, http_status status)
        return;
     assert(e->mem_obj);
     key = storeKeyPublic(e->mem_obj->url, e->mem_obj->method);
-    if ((pe = storeGet(key)) == NULL)
-       return;
-    assert(e != pe);
-    storeRelease(pe);
+    if ((pe = storeGet(key)) != NULL) {
+       assert(e != pe);
+       storeRelease(pe);
+    }
+    if (e->mem_obj->method == METHOD_GET) {
+       /* A fresh GET should eject old HEAD objects */
+       key = storeKeyPublic(e->mem_obj->url, METHOD_HEAD);
+       if ((pe = storeGet(key)) != NULL) {
+           assert(e != pe);
+           storeRelease(pe);
+       }
+    }
 }
 
 static int
@@ -357,15 +365,17 @@ httpPconnTransferDone(HttpStateData * httpState)
      * Deal with gross HTTP stuff
      *    - If we haven't seen the end of the reply headers, we can't
      *      be persistent.
+     *    - For HEAD requests we're done.
      *    - For "200 OK" check the content-length in the next block.
      *    - For "204 No Content" (even with content-length) we're done.
      *    - For "304 Not Modified" (even with content-length) we're done.
      *    - 1XX replies never have a body; we're done.
-     *    - For HEAD requests with content-length we're done.
      *    - For all other replies, check content length in next block.
      */
     if (httpState->reply_hdr_state < 2)
        return 0;
+    else if (httpState->request->method == METHOD_HEAD)
+       return 1;
     else if (reply->sline.status == HTTP_OK)
        (void) 0;               /* common case, continue */
     else if (reply->sline.status == HTTP_NO_CONTENT)
@@ -374,8 +384,6 @@ httpPconnTransferDone(HttpStateData * httpState)
        return 1;
     else if (reply->sline.status < HTTP_OK)
        return 1;
-    else if (httpState->request->method == METHOD_HEAD)
-       return 1;
     /*
      * If there is no content-length, then we can't be
      * persistent.  If there is a content length, then we must