]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
HTTP Compliance: entry is stale if request has max-age=0.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 2 Nov 2010 21:58:24 +0000 (15:58 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 2 Nov 2010 21:58:24 +0000 (15:58 -0600)
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

src/refresh.cc

index e4257f812dc200e09d8dadfb08408fe7b104a806..b8030d335e42c42c32da598889a87365e68fcd5e 100644 (file)
@@ -329,14 +329,11 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
                 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;