From: Amos Jeffries Date: Fri, 8 May 2009 10:04:08 +0000 (+1200) Subject: Author: Mark Nottingham X-Git-Tag: SQUID_3_2_0_1~1020 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ca08219d6fc002e18a32b3eee4042577324dc0c;p=thirdparty%2Fsquid.git Author: Mark Nottingham Bug 2645: allow squid to ignore must-revalidate --- diff --git a/doc/release-notes/release-3.1.sgml b/doc/release-notes/release-3.1.sgml index a0fb0a1769..2c51e36a9c 100644 --- a/doc/release-notes/release-3.1.sgml +++ b/doc/release-notes/release-3.1.sgml @@ -965,7 +965,14 @@ NOCOMMENT_START

Changing this is an RFC 2616 violation and now requires --enable-http-violations refresh_pattern -

New set of basic patterns. These should always be listed after any custom ptterns. +

New option 'ignore-must-revalidate'. + + 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. + +

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. diff --git a/src/cache_cf.cc b/src/cache_cf.cc index b9db3e9e78..debb829dcd 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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; diff --git a/src/cf.data.pre b/src/cf.data.pre index 2b4f1c6773..ade142968c 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/refresh.cc b/src/refresh.cc index 05ea670cac..90de81ef26 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -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; } diff --git a/src/structs.h b/src/structs.h index 4b0b564def..2c1eae4c82 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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