@@ -514,6 +517,10 @@
This will be included by default if available (see the --without-netfilter-conntrack configure option for more details).
miss sets a value for a cache miss. It is available for both the tos and mark options and takes precedence over the preserve-miss feature.
+ refresh_pattern
+
New option max-stale= to provide a maximum staleness factor. Squid won't
+ serve objects more stale than this even if it failed to validate the object.
+
tcp_outgoing_mark
New configuration parameter tcp_outgoing_mark
Allows packets leaving Squid on the server side to be marked with a Netfilter mark value in the same way as the existing tcp_outgoing_tos feature.
@@ -867,13 +874,9 @@
logformat
%oa tag not yet ported from 2.7
- max_stale
-
Not yet ported from 2.7
-
refresh_pattern
stale-while-revalidate= not yet ported from 2.7
ignore-stale-while-revalidate= not yet ported from 2.7
-
max-stale= not yet ported from 2.7
negative-ttl= not yet ported from 2.7
refresh_stale_hit
=== modified file 'src/cache_cf.cc'
--- src/cache_cf.cc 2010-12-20 23:52:52 +0000
+++ src/cache_cf.cc 2010-12-26 13:04:10 +0000
@@ -2651,6 +2651,9 @@
(int) (100.0 * head->pct + 0.5),
(int) head->max / 60);
+ if (head->max_stale >= 0)
+ storeAppendPrintf(entry, " max-stale=%d", head->max_stale);
+
if (head->flags.refresh_ims)
storeAppendPrintf(entry, " refresh-ims");
@@ -2704,6 +2707,7 @@
time_t max = 0;
int refresh_ims = 0;
int store_stale = 0;
+ int max_stale = -1;
#if USE_HTTP_VIOLATIONS
@@ -2782,6 +2786,8 @@
refresh_ims = 1;
} else if (!strcmp(token, "store-stale")) {
store_stale = 1;
+ } else if (!strncmp(token, "max-stale=", 10)) {
+ max_stale = atoi(token + 10);
#if USE_HTTP_VIOLATIONS
} else if (!strcmp(token, "override-expire"))
@@ -2809,7 +2815,7 @@
#endif
} else
- debugs(22, 0, "redreshAddToList: Unknown option '" << pattern << "': " << token);
+ debugs(22, 0, "refreshAddToList: Unknown option '" << pattern << "': " << token);
}
if ((errcode = regcomp(&comp, pattern, flags)) != 0) {
@@ -2838,6 +2844,8 @@
if (store_stale)
t->flags.store_stale = 1;
+ t->max_stale = max_stale;
+
#if USE_HTTP_VIOLATIONS
if (override_expire)
=== modified file 'src/cf.data.pre'
--- src/cf.data.pre 2010-12-15 10:12:22 +0000
+++ src/cf.data.pre 2010-12-26 13:43:30 +0000
@@ -3686,6 +3686,17 @@
See http://wiki.squid-cache.org/SquidFaq/SquidAcl for details.
DOC_END
+NAME: max_stale
+COMMENT: time-units
+TYPE: time_t
+LOC: Config.maxStale
+DEFAULT: 1 week
+DOC_START
+ This option puts an upper limit on how stale content Squid
+ will serve from the cache if cache validation fails.
+ Can be overriden by the refresh_pattern max-stale option.
+DOC_END
+
NAME: refresh_pattern
TYPE: refreshpattern
LOC: Config.Refresh
@@ -3718,6 +3729,7 @@
ignore-must-revalidate
ignore-private
ignore-auth
+ max-stale=NN
refresh-ims
store-stale
@@ -3783,6 +3795,10 @@
not cache such responses because they usually can't be
reused. Note that such responses will be stale by default.
+ max-stale=NN provided a maximum staleness factor. Squid won't
+ serve objects more stale than this even if it failed to
+ validate the object. Default: use the max_stale global limit.
+
Basically a cached object is:
FRESH if expires < now, else STALE
=== modified file 'src/refresh.cc'
--- src/refresh.cc 2010-12-26 12:37:51 +0000
+++ src/refresh.cc 2010-12-26 13:35:39 +0000
@@ -86,6 +86,7 @@
STALE_EXPIRES,
STALE_MAX_RULE,
STALE_LMFACTOR_RULE,
+ STALE_MAX_STALE,
STALE_DEFAULT = 299
};
@@ -388,7 +389,16 @@
/*
* At this point the response is stale, unless one of
* the override options kicks in.
+ * NOTE: max-stale config blocks the overrides.
*/
+ int max_stale = (R->max_stale >= 0 ? R->max_stale : Config.maxStale);
+ if ( max_stale >= 0 && staleness < max_stale) {
+ debugs(22, 3, "refreshCheck: YES: max-stale limit");
+ if (request)
+ request->flags.fail_on_validation_err = 1;
+ return STALE_MAX_STALE;
+ }
+
if (sf.expires) {
#if USE_HTTP_VIOLATIONS
=== modified file 'src/structs.h'
--- src/structs.h 2010-12-26 12:37:51 +0000
+++ src/structs.h 2010-12-26 13:27:38 +0000
@@ -167,6 +167,7 @@
#if USE_HTTP_VIOLATIONS
time_t negativeTtl;
#endif
+ time_t maxStale;
time_t negativeDnsTtl;
time_t positiveDnsTtl;
time_t shutdownLifetime;
@@ -1107,6 +1108,7 @@
unsigned int ignore_auth:1;
#endif
} flags;
+ int max_stale;
};
/*