From c844a622fcd601956e14ebc6dac4e6fb99ad4247 Mon Sep 17 00:00:00 2001 From: "Paul J. Reder" Date: Thu, 12 Sep 2002 16:56:56 +0000 Subject: [PATCH] mod_cache: cache_storage.c. Add the hostname and any request args to the key generated for caching. This provides a unique key for each virtual host and for each request with unique args. [Paul J. Reder, args code provided by Kris Verbeeck] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96773 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ modules/experimental/cache_storage.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index cf6158d465..987944065b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,9 @@ Changes with Apache 2.0.41 + *) mod_cache: cache_storage.c. Add the hostname and any request + args to the key generated for caching. This provides a unique + key for each virtual host and for each request with unique + args. [Paul J. Reder, args code provided by Kris Verbeeck] + *) mod_cache: Do not cache responses to GET requests with query URLs if the origin server does not explicitly provide an Expires header on the response (RFC 2616 Section 13.9) diff --git a/modules/experimental/cache_storage.c b/modules/experimental/cache_storage.c index aeef53419a..b111183223 100644 --- a/modules/experimental/cache_storage.c +++ b/modules/experimental/cache_storage.c @@ -294,8 +294,13 @@ apr_status_t cache_read_entity_body(cache_handle_t *h, apr_pool_t *p, apr_bucket apr_status_t cache_generate_key_default( request_rec *r, apr_pool_t*p, char**key ) { - *key = apr_pstrdup(p,r->uri); - return APR_SUCCESS; + if (r->hostname) { + *key = apr_pstrcat(p, r->hostname, r->uri, "?", r->args, NULL); + } + else { + *key = apr_pstrcat(p, r->uri, "?", r->args, NULL); + } + return APR_SUCCESS; } APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(cache, CACHE, int, create_entity, -- 2.40.0