]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Mark Nottingham <mnot@pobox.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 8 May 2009 10:04:08 +0000 (22:04 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 8 May 2009 10:04:08 +0000 (22:04 +1200)
Bug 2645: allow squid to ignore must-revalidate

doc/release-notes/release-3.1.sgml
src/cache_cf.cc
src/cf.data.pre
src/refresh.cc
src/structs.h

index a0fb0a17691cf26d04a405e98a7dc85c4f0ba5a8..2c51e36a9c0d9ee82005b8d840309d20b6525250 100644 (file)
@@ -965,7 +965,14 @@ NOCOMMENT_START
        <p>Changing this is an RFC 2616 violation and now requires --enable-http-violations
 
        <tag>refresh_pattern</tag>
-       <p>New set of basic patterns. These should always be listed after any custom ptterns.
+       <p>New option 'ignore-must-revalidate'.
+       <verb>
+       ignore-must-revalidate ignores any ``Cache-Control: must-revalidate``
+       headers received from a server. Doing this VIOLATES
+       the HTTP standard. Enabling this feature could make you
+       liable for problems which it causes.
+       </verb>
+       <p>New set of basic patterns. These should always be listed after any custom patterns.
           They ensure RFC compliance with certain protocol and request handling in the absence
           of accurate Cache-Control: and Expires: information.
        <verb>
index b9db3e9e78bc66fd29329f470bed1ec208d27c15..debb829dcd81b4055a1a882bbe3b1784322c5cc6 100644 (file)
@@ -579,6 +579,13 @@ configDoConfigure(void)
             break;
         }
 
+        for (R = Config.Refresh; R; R = R->next) {
+             if (!R->flags.ignore_must_revalidate)
+                 continue;
+             debugs(22, 1, "WARNING: use of 'ignore-must-revalidate' in 'refresh_pattern' violates HTTP");
+             break;
+        }
+
         for (R = Config.Refresh; R; R = R->next) {
             if (!R->flags.ignore_private)
                 continue;
@@ -2208,6 +2215,9 @@ dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
         if (head->flags.ignore_no_store)
             storeAppendPrintf(entry, " ignore-no-store");
 
+        if (head->flags.ignore_must_revalidate)
+            storeAppendPrintf(entry, " ignore-must-revalidate");
+
         if (head->flags.ignore_private)
             storeAppendPrintf(entry, " ignore-private");
 
@@ -2239,6 +2249,7 @@ parse_refreshpattern(refresh_t ** head)
     int ignore_reload = 0;
     int ignore_no_cache = 0;
     int ignore_no_store = 0;
+    int ignore_must_revalidate = 0;
     int ignore_private = 0;
     int ignore_auth = 0;
 #endif
@@ -2295,6 +2306,8 @@ parse_refreshpattern(refresh_t ** head)
             ignore_no_cache = 1;
         else if (!strcmp(token, "ignore-no-store"))
             ignore_no_store = 1;
+        else if (!strcmp(token, "ignore-must-revalidate"))
+            ignore_must_revalidate = 1;
         else if (!strcmp(token, "ignore-private"))
             ignore_private = 1;
         else if (!strcmp(token, "ignore-auth"))
@@ -2356,6 +2369,9 @@ parse_refreshpattern(refresh_t ** head)
     if (ignore_no_store)
         t->flags.ignore_no_store = 1;
 
+    if (ignore_must_revalidate)
+        t->flags.ignore_must_revalidate = 1;
+
     if (ignore_private)
         t->flags.ignore_private = 1;
 
index 2b4f1c6773fa7f320f669a4d3ab13bde32f06365..ade142968c7f457ca373c50a30d07fd5a0bf4b72 100644 (file)
@@ -2935,6 +2935,7 @@ DOC_START
                 ignore-reload
                 ignore-no-cache
                 ignore-no-store
+                ignore-must-revalidate
                 ignore-private
                 ignore-auth
                 refresh-ims
@@ -2969,6 +2970,11 @@ DOC_START
                the HTTP standard. Enabling this feature could make you
                liable for problems which it causes.
 
+               ignore-must-revalidate ignores any ``Cache-Control: must-revalidate``
+               headers received from a server. Doing this VIOLATES
+               the HTTP standard. Enabling this feature could make you
+               liable for problems which it causes.
+
                ignore-private ignores any ``Cache-control: private''
                headers received from a server. Doing this VIOLATES
                the HTTP standard. Enabling this feature could make you
index 05ea670cace8f6a1527112eecedf6c1a21e23aa9..90de81ef261b3f9eadc48cd8987ac8280ecfccb0 100644 (file)
@@ -271,7 +271,11 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 
     debugs(22, 3, "\tentry->timestamp:\t" << mkrfc1123(entry->timestamp));
 
-    if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1) {
+    if (EBIT_TEST(entry->flags, ENTRY_REVALIDATE) && staleness > -1
+#if HTTP_VIOLATIONS
+        && !R->flags.ignore_must_revalidate
+#endif
+    ) {
         debugs(22, 3, "refreshCheck: YES: Must revalidate stale response");
         return STALE_MUST_REVALIDATE;
     }
index 4b0b564def52d8f39fa5cd127c9a5aeb3b0c90b6..2c1eae4c82caef5ab8519a2cb40971e36263af54 100644 (file)
@@ -1083,6 +1083,7 @@ struct _refresh_t {
         unsigned int ignore_reload:1;
         unsigned int ignore_no_cache:1;
         unsigned int ignore_no_store:1;
+        unsigned int ignore_must_revalidate:1;
         unsigned int ignore_private:1;
         unsigned int ignore_auth:1;
 #endif