]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Mark Nottingham <mnot@pobox.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 15 May 2009 06:38:46 +0000 (18:38 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 15 May 2009 06:38:46 +0000 (18:38 +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 dce25cba7b468d050876e3341e64d527c3aad179..af8a770b3241be32c9f2235ce61e766d11475673 100644 (file)
@@ -958,7 +958,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 b2c60bb37cb68977d8b346a3d81ee053de80b867..7db3150dfc1e5235df59c593a41180817d18a2c3 100644 (file)
@@ -582,6 +582,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;
@@ -2211,6 +2218,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");
 
@@ -2242,6 +2252,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
@@ -2298,6 +2309,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"))
@@ -2359,6 +2372,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 605bdd830667ba63612cb0a420df8d9984320956..e7e53807bfa231269810f283b40ece260fbfe554 100644 (file)
@@ -2904,6 +2904,7 @@ DOC_START
                 ignore-reload
                 ignore-no-cache
                 ignore-no-store
+                ignore-must-revalidate
                 ignore-private
                 ignore-auth
                 refresh-ims
@@ -2938,6 +2939,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 e83b11b74c3971d939be39a3d6c1ccc8434b8c2e..8065a509c11278561c4c12e48af46745c006ef39 100644 (file)
@@ -1086,6 +1086,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