]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r823536, r823563 from trunk:
authorDaniel Earl Poirier <poirier@apache.org>
Thu, 29 Oct 2009 17:06:15 +0000 (17:06 +0000)
committerDaniel Earl Poirier <poirier@apache.org>
Thu, 29 Oct 2009 17:06:15 +0000 (17:06 +0000)
mod_cache: add Cache-control: s-maxage to cacheability decisions per RFC 2616.

Update doc to match change to mod_cache to include s-maxage in
some cacheability decisions.

Reviewed by: sf, covener

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

CHANGES
STATUS
docs/manual/caching.xml
modules/cache/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 314078c614060dd5f6ffe5c4eef4009f67a77585..6880c40054a23628285759e358ad5a488f45f172 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.15
 
+  *) mod_cache: correctly consider s-maxage in cacheability
+     decisions.  [Dan Poirier]
+
   *) core: Return APR_EOF if request body is shorter than the length announced
      by the client. PR 33098 [ Stefan Fritsch <sf sfritsch.de>]
 
diff --git a/STATUS b/STATUS
index 4141c2929f6e1c58f7c0415203522d25e4bbd15b..64c933a3c4525fd3692b707808cac65ffcfae2db 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -87,14 +87,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
- * mod_cache: treat s-maxage as an explicit expiration in cacheability
-              decisions, per RFC 2616
-   Trunk Patch: http://svn.apache.org/viewvc?rev=823536&view=rev
-                http://svn.apache.org/viewvc?rev=823563&view=rev
-   2.2.x Patch: http://people.apache.org/~poirier/smaxage.patch
-                (trunk patch works, except for CHANGES)
-   +1: poirier, sf, covener
-
  * mod_rewrite: don't fully qualify hostname:port if the request is a CONNECT
                 request
    Trunk Patch: http://svn.apache.org/viewvc?view=rev&revision=822004
index ffbca3b44f8aacb820b8fc87eb76667be2f13dee..4a0e8cbd909839e5cbdb1949cb721989ab28481d 100644 (file)
         in the "Cache-Control:" header.</li>
 
         <li>If the URL included a query string (e.g. from a HTML form GET
-        method) it will not be cached unless the response includes an
-        "Expires:" header, as per RFC2616 section 13.9.</li>
+        method) it will not be cached unless the response specifies an
+        explicit expiration by including an "Expires:" header or the max-age
+        or s-maxage directive of the "Cache-Control:" header, as per RFC2616
+        sections 13.9 and 13.2.1.</li>
 
         <li>If the response has a status of 200 (OK), the response must
         also include at least one of the "Etag", "Last-Modified" or
-        the "Expires" headers, unless the 
+        the "Expires" headers, or the max-age or s-maxage directive of
+        the "Cache-Control:" header, unless the 
         <directive module="mod_cache">CacheIgnoreNoLastMod</directive> 
         directive has been used to require otherwise.</li>
 
index 49a374239cd2f2641432867a03e36bc1f8261078..bda2f1f9a4ec1ace8682da8e784904f4c2c7bc7f 100644 (file)
@@ -473,7 +473,8 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
         reason = "Expires header already expired, not cacheable";
     }
     else if (!conf->ignorequerystring && r->parsed_uri.query && exps == NULL &&
-             !ap_cache_liststr(NULL, cc_out, "max-age", NULL)) {
+             !ap_cache_liststr(NULL, cc_out, "max-age", NULL) &&
+             !ap_cache_liststr(NULL, cc_out, "s-maxage", NULL)) {
         /* if a query string is present but no explicit expiration time,
          * don't cache it (RFC 2616/13.9 & 13.2.1)
          */
@@ -487,14 +488,17 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
         reason = "HTTP Status 304 Not Modified";
     }
     else if (r->status == HTTP_OK && lastmods == NULL && etag == NULL
-             && (exps == NULL) && (conf->no_last_mod_ignore ==0)) {
+             && (exps == NULL) && (conf->no_last_mod_ignore ==0) &&
+             !ap_cache_liststr(NULL, cc_out, "max-age", NULL) &&
+             !ap_cache_liststr(NULL, cc_out, "s-maxage", NULL)) {
         /* 200 OK response from HTTP/1.0 and up without Last-Modified,
-         * Etag, or Expires headers.
+         * Etag, Expires, Cache-Control:max-age, or Cache-Control:s-maxage
+         * headers.
          */
         /* Note: mod-include clears last_modified/expires/etags - this
          * is why we have an optional function for a key-gen ;-)
          */
-        reason = "No Last-Modified, Etag, or Expires headers";
+        reason = "No Last-Modified, Etag, Expires, Cache-Control:max-age or Cache-Control:s-maxage headers";
     }
     else if (r->header_only && !cache->stale_handle) {
         /* Forbid HEAD requests unless we have it cached already */