diff options
author | Jan Kaluža <jkaluza@apache.org> | 2014-05-26 11:15:44 +0200 |
---|---|---|
committer | Jan Kaluža <jkaluza@apache.org> | 2014-05-26 11:15:44 +0200 |
commit | 66dc61a3f4d8c7ae41546593b2cd39509f90b414 (patch) | |
tree | 5d18d0525ed0c1e6a906320033437cf594ae3933 /modules/cache/cache_util.c | |
parent | * Give ap_proxy_post_request as chance to act correctly on the status code (diff) | |
download | apache2-66dc61a3f4d8c7ae41546593b2cd39509f90b414.tar.xz apache2-66dc61a3f4d8c7ae41546593b2cd39509f90b414.zip |
mod_cache: try to use the key of a possible open but stale cache entry
if we have one in cache_try_lock(). PR 50317
Submitted by: Ruediger Pluem
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1597533 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/cache/cache_util.c')
-rw-r--r-- | modules/cache/cache_util.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index bf45093192..3cff6f69e8 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -284,7 +284,25 @@ apr_status_t cache_try_lock(cache_server_conf *conf, cache_request_rec *cache, /* create the key if it doesn't exist */ if (!cache->key) { - cache_generate_key(r, r->pool, &cache->key); + cache_handle_t *h; + /* + * Try to use the key of a possible open but stale cache + * entry if we have one. + */ + if (cache->handle != NULL) { + h = cache->handle; + } + else { + h = cache->stale_handle; + } + if ((h != NULL) && + (h->cache_obj != NULL) && + (h->cache_obj->key != NULL)) { + cache->key = apr_pstrdup(r->pool, h->cache_obj->key); + } + else { + cache_generate_key(r, r->pool, &cache->key); + } } /* create a hashed filename from the key, and save it for later */ |