From: Jan Kaluža Date: Mon, 26 May 2014 09:15:44 +0000 (+0000) Subject: mod_cache: try to use the key of a possible open but stale cache entry X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=675797c96891b5ccbf180d4b0b4ba4562283e3c3;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index bf450931927..3cff6f69e87 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 */