--------------------- PatchSet 4779 Date: 2002/08/25 12:35:49 Author: rbcollins Branch: esi Tag: (none) Log: Duanes fix to prevent clobbering methods Members: src/client_side_reply.c:1.1.2.18->1.1.2.19 Index: squid/src/client_side_reply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.c,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -u -r1.1.2.18 -r1.1.2.19 --- squid/src/client_side_reply.c 25 Aug 2002 08:59:04 -0000 1.1.2.18 +++ squid/src/client_side_reply.c 25 Aug 2002 12:35:49 -0000 1.1.2.19 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.c,v 1.1.2.18 2002/08/25 08:59:04 rbcollins Exp $ + * $Id: client_side_reply.c,v 1.1.2.19 2002/08/25 12:35:49 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1262,8 +1262,17 @@ if (context->http->entry != NULL) { /* someone found the object in the cache for us */ storeLockObject(context->http->entry); - storeCreateMemObject(context->http->entry, context->http->uri, context->http->log_uri); - context->http->entry->mem_obj->method = context->http->request->method; + if (context->http->entry->mem_obj == NULL) { + /* + * 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(context->http->entry, context->http->uri, context->http->log_uri); + context->http->entry->mem_obj->method = context->http->request->method; + } context->sc = storeClientListAdd(context->http->entry, context); #if DELAY_POOLS delaySetStoreClient(context->http->sc, delayClient(context->http));