]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
HTTP/1.1: honour Cache-Control before Pragma:no-cache
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Oct 2012 00:43:57 +0000 (18:43 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Oct 2012 00:43:57 +0000 (18:43 -0600)
HTTPbis WG clarifications on the interaction between Cache-Control and
Pragma specify that Cache-Control may be explicitly crafted to allow
conditional caching by HTTP/1.1 caches and Pragma:no-cache supplied to
prevent caching by older HTTP/1.0 caches unable to understand the
Cache-Control properly.

Squid does obey Cache-Control. So we can deprecate Pragma to the side
cases when Cache-Control is absent entirely.

src/client_side_request.cc

index adc14fc42dbc947a0aeb03f40fa360a2597cda36..57ff34f9e278c6d7efce92e09bd4053b602a8a74 100644 (file)
@@ -1030,19 +1030,14 @@ clientInterpretRequestHeaders(ClientHttpRequest * http)
         request->flags.ims = 1;
 
     if (!request->flags.ignore_cc) {
-        if (req_hdr->has(HDR_PRAGMA)) {
-            String s = req_hdr->getList(HDR_PRAGMA);
-
-            if (strListIsMember(&s, "no-cache", ','))
-                no_cache=true;
-
-            s.clean();
-        }
-
-        if (request->cache_control)
+        if (request->cache_control) {
             if (request->cache_control->noCache())
                 no_cache=true;
 
+        // RFC 2616: treat Pragma:no-cache as if it was Cache-Control:no-cache when Cache-Control is missing
+        } else if (req_hdr->has(HDR_PRAGMA))
+            no_cache = req_hdr->hasListMember(HDR_PRAGMA,"no-cache",',');
+
         /*
         * Work around for supporting the Reload button in IE browsers when Squid
         * is used as an accelerator or transparent proxy, by turning accelerated