1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#! /bin/sh /usr/share/dpatch/dpatch-run
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: mod_cache: Handle If-Range correctly if the cached resource was stale.
## DP: PR 44579 , #470652
@DPATCH@
Index: modules/cache/mod_cache.c
===================================================================
--- a/modules/cache/mod_cache.c (revision 636385)
+++ b/modules/cache/mod_cache.c (revision 636386)
@@ -613,6 +613,12 @@
cache->provider->remove_entity(cache->stale_handle);
/* Treat the request as if it wasn't conditional. */
cache->stale_handle = NULL;
+ /*
+ * Restore the original request headers as they may be needed
+ * by further output filters like the byterange filter to make
+ * the correct decisions.
+ */
+ r->headers_in = cache->stale_headers;
}
}
Index: modules/cache/cache_storage.c
===================================================================
--- a/modules/cache/cache_storage.c (revision 636652)
+++ b/modules/cache/cache_storage.c (revision 636653)
@@ -286,6 +286,13 @@
apr_table_unset(r->headers_in, "If-Range");
apr_table_unset(r->headers_in, "If-Unmodified-Since");
+ /*
+ * Do not do Range requests with our own conditionals: If
+ * we get 304 the Range does not matter and otherwise the
+ * entity changed and we want to have the complete entity
+ */
+ apr_table_unset(r->headers_in, "Range");
+
etag = apr_table_get(h->resp_hdrs, "ETag");
lastmod = apr_table_get(h->resp_hdrs, "Last-Modified");
|