]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r933919, r951222:
authorStefan Fritsch <sf@apache.org>
Tue, 29 May 2012 19:55:37 +0000 (19:55 +0000)
committerStefan Fritsch <sf@apache.org>
Tue, 29 May 2012 19:55:37 +0000 (19:55 +0000)
* Do not cache 206 responses in any case since we currently do not provide any
  backends that are capable to cache partial responses. PR 49113.
  Fixes regression of r724093.

Submitted by: minfrin
Reviewed by: rjung, wrowe, sf

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

CHANGES
STATUS
modules/cache/mod_cache.c
modules/cache/mod_disk_cache.c
modules/cache/mod_mem_cache.c

diff --git a/CHANGES b/CHANGES
index 5160517e286c11d6d60283be8f96348d4bf64a3b..4bbcac36401d59c5699fa5bf65f2852aa93500b3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,11 @@ Changes with Apache 2.2.23
      envvars: Fix insecure handling of LD_LIBRARY_PATH that could lead to the
      current working directory to be searched for DSOs. [Stefan Fritsch]
 
+  *) mod_disk_cache, mod_mem_cache: Decline the opportunity to cache if the
+     response is a 206 Partial Content. This stops a reverse proxied partial
+     response from becoming cached, and then being served in subsequent
+     responses. [Graham Leggett]
+
   *) configure: Fix usage with external apr and apu in non-default paths
      and recent gcc versions >= 4.6. [Jean-Frederic Clere]
 
diff --git a/STATUS b/STATUS
index bfcf509ce57de054bd8ace2df491e2493439d17f..5fd07b82a33dfe05d4c5397e00902de486052d14 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -93,20 +93,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_cache: * Do not cache 206 responses in any case since we currently do not provide any
-    backends that are capable to cache partial responses. PR 49113.
-    Fixes regression of r724093.
-      Trunk version of patch:
-         http://svn.apache.org/viewcvs.cgi?rev=933919&view=rev
-      Backport version for 2.2.x of patch:
-         Trunk version of patch works
-      +1: rpluem
-      minfrin: The r933919 patch is obsolete, as this trunk code no longer
-               exists. The fix you're after is r951222, backported to both
-               mod_disk_cache.c and mod_mem_cache.c.
-      rjung: I combined backports of r933919 and r951222:
-      http://people.apache.org/~rjung/patches/mod_cache_partial_content-2.2.x.patch
-      +1: rjung, wrowe, sf
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 8aeb3f73ca77e13230b0f37fdeb7585050a45943..2f649ef2dbb25a9a7401a089d21f3d37d2e9b876 100644 (file)
@@ -473,7 +473,8 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
          * 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) {
+        if ((exps != NULL || cc_out != NULL)
+            && r->status != HTTP_PARTIAL_CONTENT) {
             /* 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
@@ -486,6 +487,9 @@ 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 {
index f13800b3067b242a70a49cf0566a6edfa438ccf8..13d6c8b300b2a87680b11fee0016ffe99072f452 100644 (file)
@@ -330,6 +330,14 @@ static int create_entity(cache_handle_t *h, request_rec *r, const char *key, apr
         return DECLINED;
     }
 
+    /* we don't support caching of range requests (yet) */
+    if (r->status == HTTP_PARTIAL_CONTENT) {
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                     "disk_cache: URL %s partial content response not cached",
+                     key);
+        return DECLINED;
+    }
+
     /* Allocate and initialize cache_object_t and disk_cache_object_t */
     h->cache_obj = obj = apr_pcalloc(r->pool, sizeof(*obj));
     obj->vobj = dobj = apr_pcalloc(r->pool, sizeof(*dobj));
index 38aa8f84668e4e0b3d71f8fecb1f2166841d21ff..b845b98330a9f8a9e3447b253dc0087374b147ca 100644 (file)
@@ -313,6 +313,14 @@ static int create_entity(cache_handle_t *h, cache_type_e type_e,
     cache_object_t *obj, *tmp_obj;
     mem_cache_object_t *mobj;
 
+    /* we don't support caching of range requests (yet) */
+    if (r->status == HTTP_PARTIAL_CONTENT) {
+        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                     "disk_cache: URL %s partial content response not cached",
+                     key);
+        return DECLINED;
+    }
+
     if (len == -1) {
         /* Caching a streaming response. Assume the response is
          * less than or equal to max_streaming_buffer_size. We will