Commit 811c01c6 authored by Graham Leggett's avatar Graham Leggett
Browse files

mod_cache: When content is served stale, and there is no means to

revalidate the content using ETag or Last-Modified, and we have
mandated no stale-on-error behaviour, stand down and don't cache.
Saves a cache write that will never be read.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1103494 13f79535-47bb-0310-9956-ffa450edef68
parent 073d8a67
Loading
Loading
Loading
Loading
+6 −0
Changes for CHANGES: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,12 @@

Changes with Apache 2.3.13

  *) mod_cache: When content is served stale, and there is no means to
     revalidate the content using ETag or Last-Modified, and we have
     mandated no stale-on-error behaviour, stand down and don't cache.
     Saves a cache write that will never be read.
     [Graham Leggett]

  *) mod_reqtimeout: Fix a timed out connection going into the keep-alive
     state after a timeout when discarding a request body. PR 51103.
     [Stefan Fritsch]
+9 −2
Changes for modules/cache/mod_cache.c: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -967,11 +967,18 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
        reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
    }
    else if (!dconf->store_expired && exp != APR_DATE_BAD
            && exp < r->request_time)
    {
            && exp < r->request_time) {
        /* if a Expires header is in the past, don't cache it */
        reason = "Expires header already expired; not cacheable";
    }
    else if (!dconf->store_expired && (control.must_revalidate
            || control.proxy_revalidate) && (!control.s_maxage_value
            || (!control.s_maxage && !control.max_age_value)) && lastmod
            == NULL && etag == NULL) {
        /* if we're already stale, but can never revalidate, don't cache it */
        reason
                = "s-maxage or max-age zero and no Last-Modified or Etag; not cacheable";
    }
    else if (!conf->ignorequerystring && r->parsed_uri.query && exps == NULL
            && !control.max_age && !control.s_maxage) {
        /* if a query string is present but no explicit expiration time,