You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by re...@apache.org on 2008/12/18 01:25:17 UTC

svn commit: r727599 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/mod_cache.c

Author: rederpj
Date: Wed Dec 17 16:25:16 2008
New Revision: 727599

URL: http://svn.apache.org/viewvc?rev=727599&view=rev
Log:
Committing the following that was voted in:
When an expires or cache-control header are sent, the RFC does allow us to cache normally non-cacheable response statuses.
Submitted by: Alex Polvi <alex polvi.net>


Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=727599&r1=727598&r2=727599&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Dec 17 16:25:16 2008
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.12
 
+  *) mod_cache: When an explicit Expires or Cache-Control header is set, cache
+     normally non-cacheable response statuses. PR 46346.
+     [Alex Polvi <alex polvi.net>]
 
 Changes with Apache 2.2.11
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=727599&r1=727598&r2=727599&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Dec 17 16:25:16 2008
@@ -89,16 +89,6 @@
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 
-
- * mod_cache: When an expires or cache-control header are sent, the RFC does
-   allow us to cache normally non-cacheable response statuses.
-   PR 46346.
-   Trunk version of patch:
-      http://svn.apache.org/viewvc?rev=724093&view=rev
-   Backport version for 2.2.x of patch:
-      Trunk version of patch works
-   +1: rpluem, covener, rederpj
-
  * mod_cache: Correctly save Content-Encoding of cachable entity. PR 46401
    [Dan Poirier <poirier pobox.com>]
    Trunk version of patch (committed by rpluem):

Modified: httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c?rev=727599&r1=727598&r2=727599&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/mod_cache.c Wed Dec 17 16:25:16 2008
@@ -440,7 +440,28 @@
          * We include 304 Not Modified here too as this is the origin server
          * telling us to serve the cached copy.
          */
-        reason = apr_psprintf(p, "Response status %d", r->status);
+        if (exps != NULL || cc_out != NULL) {
+            /* We are also allowed to cache any response given that it has a 
+             * valid Expires or Cache Control header. If we find a either of 
+             * those here,  we pass request through the rest of the tests. From 
+             * the RFC:
+             *
+             * A response received with any other status code (e.g. status 
+             * codes 302 and 307) MUST NOT be returned in a reply to a 
+             * subsequent request unless there are cache-control directives or 
+             * another header(s) that explicitly allow it. For example, these 
+             * include the following: an Expires header (section 14.21); a 
+             * "max-age", "s-maxage",  "must-revalidate", "proxy-revalidate", 
+             * "public" or "private" cache-control directive (section 14.9).
+             */
+        }
+        else {
+            reason = apr_psprintf(p, "Response status %d", r->status);
+        }
+    }
+
+    if (reason) {
+        /* noop */
     }
     else if (exps != NULL && exp == APR_DATE_BAD) {
         /* if a broken Expires header is present, don't cache it */