]> granicus.if.org Git - apache/commitdiff
mod_cache: add Cache-control: s-maxage to cacheability decisions per RFC 2616.
authorDaniel Earl Poirier <poirier@apache.org>
Fri, 9 Oct 2009 12:58:09 +0000 (12:58 +0000)
committerDaniel Earl Poirier <poirier@apache.org>
Fri, 9 Oct 2009 12:58:09 +0000 (12:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@823536 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 7abfc2b9490ca4d86366d468740b2ab8a1a7d0ed..bab6290cba4da3ee74ba9a83f56e771f8ec837ca 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,9 @@ Changes with Apache 2.3.3
      mod_proxy_ftp: NULL pointer dereference on error paths.
      [Stefan Fritsch <sf fritsch.de>, Joe Orton]
 
+  *) mod_cache: correctly consider s-maxage in cacheability
+     decisions.  [Dan Poirier]
+
   *) mod_logio/core: Report more accurate byte counts in mod_status if
      mod_logio is loaded. PR 25656. [Stefan Fritsch]
 
index 78472c33585f6396b0ea2da1ebb44bbaa5c199bc..27bf3368fac975a61fe26bf23baa741c27631caa 100644 (file)
@@ -767,7 +767,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)
          */
@@ -781,14 +782,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 */