From: hno <> Date: Sun, 10 Oct 2004 08:45:11 +0000 (+0000) Subject: Bug #616: Negative cached 404 replies with VARY header never matches X-Git-Tag: SQUID_3_0_PRE4~1030 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b44c90752af8c09c1969254641bd3117540cefb;p=thirdparty%2Fsquid.git Bug #616: Negative cached 404 replies with VARY header never matches --- diff --git a/src/http.cc b/src/http.cc index 97581449a3..dce448b998 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.431 2004/08/30 03:28:59 robertc Exp $ + * $Id: http.cc,v 1.432 2004/10/10 02:45:11 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -685,28 +685,26 @@ HttpStateData::processReplyHeader(const char *buf, int size) if (neighbors_do_private_keys) httpMaybeRemovePublic(entry, entry->getReply()->sline.status); - switch (cacheableReply()) { - - case 1: - - if (httpHeaderHas(&entry->getReply()->header, HDR_VARY) + if (httpHeaderHas(&entry->getReply()->header, HDR_VARY) #if X_ACCELERATOR_VARY - || httpHeaderHas(&entry->getReply()->header, HDR_X_ACCELERATOR_VARY) + || httpHeaderHas(&entry->getReply()->header, HDR_X_ACCELERATOR_VARY) #endif - ) { - const char *vary = httpMakeVaryMark(orig_request, entry->getReply()); + ) { + const char *vary = httpMakeVaryMark(orig_request, entry->getReply()); + + if (!vary) { + httpMakePrivate(entry); + goto no_cache; - if (vary) { - entry->mem_obj->vary_headers = xstrdup(vary); - /* Kill the old base object if a change in variance is detected */ - httpMakePublic(entry); - } else { - httpMakePrivate(entry); - } - } else { - httpMakePublic(entry); } + entry->mem_obj->vary_headers = xstrdup(vary); + } + + switch (cacheableReply()) { + + case 1: + httpMakePublic(entry); break; case 0: @@ -714,14 +712,22 @@ HttpStateData::processReplyHeader(const char *buf, int size) break; case -1: - httpCacheNegatively(entry); + + if (Config.negativeTtl > 0) + httpCacheNegatively(entry); + else + httpMakePrivate(entry); + break; default: assert(0); + break; } +no_cache: + if (!ignoreCacheControl && entry->getReply()->cache_control) { if (EBIT_TEST(entry->getReply()->cache_control->mask, CC_PROXY_REVALIDATE)) EBIT_SET(entry->flags, ENTRY_REVALIDATE);