]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2258: bypassing cache but not destroying cache entry
authorGarri Djavadyan <garryd@comnet.uz>
Thu, 15 Dec 2016 09:03:42 +0000 (22:03 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 15 Dec 2016 09:03:42 +0000 (22:03 +1300)
src/HttpRequest.cc
src/http.cc

index f686251079926c144d0d05ed668b177bcc36c153..a2c7afdc0941e75924e7cdc334151dde6abbd98a 100644 (file)
@@ -576,8 +576,13 @@ HttpRequest::maybeCacheable()
         if (!method.respMaybeCacheable())
             return false;
 
-        // XXX: this would seem the correct place to detect request cache-controls
-        //      no-store, private and related which block cacheability
+        // RFC 7234 section 5.2.1.5:
+        // "cache MUST NOT store any part of either this request or any response to it"
+        //
+        // NP: refresh_pattern ignore-no-store only applies to response messages
+        //     this test is handling request message CC header.
+        if (!flags.ignoreCc && cache_control && cache_control->noStore())
+            return false;
         break;
 
     case AnyP::PROTO_GOPHER:
index 59dd308c9fe9569575a01f86affdc155d2f52618..88eff994900f16704d38696887409a35d8c1b0f4 100644 (file)
@@ -191,6 +191,12 @@ httpMaybeRemovePublic(StoreEntry * e, Http::StatusCode status)
     if (!EBIT_TEST(e->flags, KEY_PRIVATE))
         return;
 
+    // If the new/incoming response cannot be stored, then it does not
+    // compete with the old stored response for the public key, and the
+    // old stored response should be left as is.
+    if (e->mem_obj->request && !e->mem_obj->request->flags.cachable)
+        return;
+
     switch (status) {
 
     case Http::scOkay: