You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2013/02/12 12:11:47 UTC

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

Author: rjung
Date: Tue Feb 12 11:11:47 2013
New Revision: 1445103

URL: http://svn.apache.org/r1445103
Log:
mod_cache: Explicitly allow cache implementations to cache a 206 Partial
Response if they so choose to do so. Previously an attempt to cache a 206
was arbitrarily allowed if the response contained an Expires or
Cache-Control header, and arbitrarily denied if both headers were missing.

Currently the disk and memory cache providers do not cache 206 Partial
Responses.

Backport of r952823 from trunk.

Submitted by: minfrin
Reviewed by: rjung, wrowe
Backported by: rpluem

Modified:
    httpd/httpd/branches/2.2.x/   (props changed)
    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

Propchange: httpd/httpd/branches/2.2.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r952823

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1445103&r1=1445102&r2=1445103&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Tue Feb 12 11:11:47 2013
@@ -1,6 +1,13 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.24
 
+  *) mod_cache: Explicitly allow cache implementations to cache a 206 Partial
+     Response if they so choose to do so. Previously an attempt to cache a 206
+     was arbitrarily allowed if the response contained an Expires or
+     Cache-Control header, and arbitrarily denied if both headers were missing.
+     Currently the disk and memory cache providers do not cache 206 Partial
+     Responses. [Graham Leggett]
+
   *) core: Remove unintentional APR 1.3 dependency introduced with
      Apache 2.2.22. [Eric Covener]
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1445103&r1=1445102&r2=1445103&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Tue Feb 12 11:11:47 2013
@@ -94,14 +94,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_cache: Allow providers to decide whether to cache responses with code
-    206.
-    Trunk version of patch:
-      http://svn.apache.org/viewvc?rev=952823&view=rev
-    Backport version for 2.2.x of patch:
-      Trunk version of patch works
-    +1: rpluem, rjung, wrowe
-
    * mod_proxy_http: Use the same hostname for SNI as for the HTTP request when
      forwarding to SSL backends.
      PR: 53134

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=1445103&r1=1445102&r2=1445103&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 Tue Feb 12 11:11:47 2013
@@ -465,16 +465,17 @@ static int cache_save_filter(ap_filter_t
      * They are tested here one by one to be clear and unambiguous.
      */
     if (r->status != HTTP_OK && r->status != HTTP_NON_AUTHORITATIVE
+        && r->status != HTTP_PARTIAL_CONTENT
         && r->status != HTTP_MULTIPLE_CHOICES
         && r->status != HTTP_MOVED_PERMANENTLY
         && r->status != HTTP_NOT_MODIFIED) {
         /* RFC2616 13.4 we are allowed to cache 200, 203, 206, 300, 301 or 410
-         * We don't cache 206, because we don't (yet) cache partial responses.
+         * We allow the caching of 206, but a cache implementation might choose
+         * to decline to cache a 206 if it doesn't know how to.
          * We include 304 Not Modified here too as this is the origin server
          * telling us to serve the cached copy.
          */
-        if ((exps != NULL || cc_out != NULL)
-            && r->status != HTTP_PARTIAL_CONTENT) {
+        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
@@ -487,9 +488,6 @@ static int cache_save_filter(ap_filter_t
              * 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).
-             *
-             * But do NOT store 206 responses in any case since we
-             * don't (yet) cache partial responses.
              */
         }
         else {