From: Jim Jagielski Date: Tue, 27 May 2008 16:23:12 +0000 (+0000) Subject: Merge r636386, r636653 from trunk: X-Git-Tag: 2.2.9~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6ce7d79ba1e338252132cc5c82fa5c01818e693;p=thirdparty%2Fapache%2Fhttpd.git Merge r636386, r636653 from trunk: * Restore the original request headers if the cached resource was stale, as they may be needed by further output filters like the byterange filter to make the correct decisions. PR: 44579 * Do not do Range requests if we use our own conditionals for validating a cache entity: If we get 304 the Range does not matter and otherwise the entity changed and we want to have the complete entity. PR: 44579 Submitted by: rpluem Reviewed by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@660584 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index b316b71e993..ca09c80baec 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.9 + *) mod_cache: Handle If-Range correctly if the cached resource was stale. + PR 44579 [Ruediger Pluem] + *) mod_proxy: Do not try a direct connection if the connection via a remote proxy failed before and the request has a request body. [Ruediger Pluem] diff --git a/STATUS b/STATUS index 57f5cef16dd..98cd694394e 100644 --- a/STATUS +++ b/STATUS @@ -90,15 +90,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_cache: Handle If-Range correctly if the cached resource was stale. - PR 44579 - Trunk version of patch: - http://svn.apache.org/viewvc?rev=636386&view=rev - http://svn.apache.org/viewvc?rev=636653&view=rev - Backport version for 2.2.x of patch: - Trunk version of patch works - +1: rpluem, niq, jim - * core: Do not allow Options ALL if not all options are allowed to be overwritten. PR 44262 Trunk version of patch: diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c index 0ddf82dd39f..7b99f3eda91 100644 --- a/modules/cache/cache_storage.c +++ b/modules/cache/cache_storage.c @@ -286,6 +286,13 @@ int cache_select(request_rec *r) 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"); diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 51341179f99..27df70d436b 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -613,6 +613,12 @@ static int cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) 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; } }