* 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
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]
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 ]
* 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
* 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 {
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));
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