]> granicus.if.org Git - apache/commitdiff
mod_cache: Handle case of an invalid Expires
authorRainer Jung <rjung@apache.org>
Sun, 24 Jun 2018 10:18:38 +0000 (10:18 +0000)
committerRainer Jung <rjung@apache.org>
Sun, 24 Jun 2018 10:18:38 +0000 (10:18 +0000)
header value RFC compliant like the case of an
Expires time in the past: allow to overwrite the
non-caching decision using CacheStoreExpired and
respect Cache-Control "max-age" and "s-maxage".

Backport of r1833876 from trunk.

Submitted by: rjung
Reviewed by: rjung, ylavic, rpluem

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1834241 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/cache/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 9615f692d15d535b3b7c0b8aee27465a95759d6a..3faadf5cce3c912ddaa6515d3c37b41079fd17a6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.34
 
+  *) mod_cache: Handle case of an invalid Expires header value RFC compliant
+     like the case of an Expires time in the past: allow to overwrite the
+     non-caching decision using CacheStoreExpired and respect Cache-Control
+     "max-age" and "s-maxage".  [Rainer Jung]
+
   *) mod_xml2enc: Fix forwarding of error metadata/responses. PR 62180.
      [Micha Lenk <micha lenk.info>, Yann Ylavic]
 
diff --git a/STATUS b/STATUS
index afa485c21a8cefebe7a10a3f71e26c5aeafe87e5..c1aaa0922579ca07c4107e162cb0f41e2f04b1cd 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -148,16 +148,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
                   svn merge -c 1833827 ^/httpd/httpd/trunk . 
      +1: covener, jim, rjung
 
-  *) mod_cache: Handle case of invalid Expires header RFC compliant
-                like the case of an Expires time in the past.
-                So allow to overwrite the non-caching decision
-                using "CacheStoreExpired" and respect Cache-Control
-                "max-age" and "s-maxage".
-     trunk patch: http://svn.apache.org/r1833876
-     2.4.x patch: trunk works (needs CHANGES in 2.4)
-                  svn merge -c 1833876 ^/httpd/httpd/trunk . 
-     +1: rjung, ylavic, rpluem
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 7982776ba8bf5e56369217832b0b714dd79b62f3..56a09f5bf56ef4e35b234fb9423a15343b5bc425 100644 (file)
@@ -1040,8 +1040,11 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
     if (reason) {
         /* noop */
     }
-    else if (exps != NULL && exp == APR_DATE_BAD) {
-        /* if a broken Expires header is present, don't cache it */
+    else if (!control.s_maxage && !control.max_age && !dconf->store_expired
+             && exps != NULL && exp == APR_DATE_BAD) {
+        /* if a broken Expires header is present, don't cache it
+         * Unless CC: s-maxage or max-age is present
+         */
         reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
     }
     else if (!control.s_maxage && !control.max_age