]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Noticed that a HEAD request for a cached GET response changes
authorwessels <>
Fri, 23 Aug 2002 02:26:38 +0000 (02:26 +0000)
committerwessels <>
Fri, 23 Aug 2002 02:26:38 +0000 (02:26 +0000)
mem_obj->method to HEAD.  This looks strange in store.log because
the entry got created (swapped out) as GET and later released as
HEAD.  This new if-block prevents changing the method value.

src/client_side.cc

index 4fceb4611f5300b3436197611addf7f53af25f3d..c391e23855f6c5a1d357fafa84e0336d6d816ddb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.585 2002/08/15 18:11:48 hno Exp $
+ * $Id: client_side.cc,v 1.586 2002/08/22 20:26:38 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1978,8 +1978,17 @@ clientProcessRequest(clientHttpRequest * http)
     http->out.offset = 0;
     if (NULL != http->entry) {
        storeLockObject(http->entry);
-       storeCreateMemObject(http->entry, http->uri, http->log_uri);
-       http->entry->mem_obj->method = r->method;
+       if (NULL == http->entry->mem_obj) {
+           /*
+            * This if-block exists because we don't want to clobber
+            * a preexiting mem_obj->method value if the mem_obj
+            * already exists.  For example, when a HEAD request
+            * is a cache hit for a GET response, we want to keep
+            * the method as GET.
+            */
+           storeCreateMemObject(http->entry, http->uri, http->log_uri);
+           http->entry->mem_obj->method = r->method;
+       }
        http->sc = storeClientListAdd(http->entry, http);
 #if DELAY_POOLS
        delaySetStoreClient(http->sc, delayClient(http));