HTTP Compliance: entry is stale if request has max-age=0.
We should always do validation for requests with Cache-Control
max-age=0, even when entry age is also zero. In our case, RFC 2616 says:
freshness_lifetime = max_age_value
response_is_fresh = (freshness_lifetime > current_age)
response_is_fresh is always false if freshness_lifetime is zero...
The check code was introduced in r5998 with a "Import of fix-ranges
branch" message. The code was commented out at the time of that commit,
for reasons unknown.
Test case:
test_case/rfc2616/noSrv-hit-stale-max-age-req
HTTP Compliance: entry is stale if request has max-age=0.
We should always do validation for requests with Cache-Control max-age=0,
even when entry age is also zero. In our case, RFC 2616 says:
freshness_lifetime = max_age_value
response_is_fresh = (freshness_lifetime > current_age)
and response_is_fresh is always false if freshness_lifetime is zero.
The check code was introduced in r5998 with a "Import of fix-ranges
branch" message. The code was commented out at the time of that
commit, for reasons unknown.
Test case:
test_case/rfc2616/noSrv-hit-stale-max-age-req
=== modified file 'src/refresh.cc'
--- src/refresh.cc 2010-05-14 09:47:03 +0000
+++ src/refresh.cc 2010-09-16 02:34:29 +0000
@@ -298,48 +298,45 @@ refreshCheck(const StoreEntry * entry, H
/* The clients no-cache header is ignored */
debugs(22, 3, "refreshCheck: MAYBE: ignore-reload");
} else if (R->flags.reload_into_ims || Config.onoff.reload_into_ims) {
/* The clients no-cache header is changed into a IMS query */
debugs(22, 3, "refreshCheck: YES: reload-into-ims");
return STALE_RELOAD_INTO_IMS;
} else {
/* The clients no-cache header is not overridden on this request */
debugs(22, 3, "refreshCheck: YES: client reload");
request->flags.nocache = 1;
return STALE_FORCED_RELOAD;
}
#endif
if (NULL != cc) {
if (cc->max_age > -1) {
#if USE_HTTP_VIOLATIONS
if (R->flags.ignore_reload && cc->max_age == 0) {} else
#endif
{
-#if 0
-
if (cc->max_age == 0) {
debugs(22, 3, "refreshCheck: YES: client-max-age = 0");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
-#endif
if (age > cc->max_age) {
debugs(22, 3, "refreshCheck: YES: age > client-max-age");
return STALE_EXCEEDS_REQUEST_MAX_AGE_VALUE;
}
}
}
if (EBIT_TEST(cc->mask, CC_MAX_STALE) && staleness > -1) {
if (cc->max_stale < 0) {
/* max-stale directive without a value */
debugs(22, 3, "refreshCheck: NO: max-stale wildcard");
return FRESH_REQUEST_MAX_STALE_ALL;
} else if (staleness < cc->max_stale) {
debugs(22, 3, "refreshCheck: NO: staleness < max-stale");
return FRESH_REQUEST_MAX_STALE_VALUE;
}
}
}
}