]> granicus.if.org Git - apache/commitdiff
mod_cache: Explicitly allow cache implementations to cache a 206 Partial
authorGraham Leggett <minfrin@apache.org>
Tue, 8 Jun 2010 21:13:06 +0000 (21:13 +0000)
committerGraham Leggett <minfrin@apache.org>
Tue, 8 Jun 2010 21:13:06 +0000 (21:13 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@952823 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/cache/mod_cache.c

diff --git a/CHANGES b/CHANGES
index 5a26e5b3e5c38f6c5155eef39679324ae888848e..f0d49ab819bdecb188cc4471cd483d0fc23d4710 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,12 @@ Changes with Apache 2.3.6
      processing is completed, avoiding orphaned callback pointers.
      [Brett Gervasoni <brettg senseofsecurity.com>, Jeff Trawick]
 
+  *) 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.
+     [Graham Leggett]
+
   *) core: Add microsecond timestamp fractions, process id and thread id
      to the error log. [Rainer Jung]
 
index beabd39ec4f7737761f9bc774f5aab11d317f15e..02ba0a61a38704411390f9dce4a0dedf2b5fc9f9 100644 (file)
@@ -726,16 +726,17 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
      * 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
@@ -748,9 +749,6 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
              * 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 {