diff options
author | Graham Leggett <minfrin@apache.org> | 2009-08-27 23:57:27 +0200 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2009-08-27 23:57:27 +0200 |
commit | fd5c2141241b3a3d2953b0e22184e25a93ea4d25 (patch) | |
tree | 646af789b9febe502fa8c79a147023ae42826e30 | |
parent | Log the return code in the debug message to properly indicate why the lock (diff) | |
download | apache2-fd5c2141241b3a3d2953b0e22184e25a93ea4d25.tar.xz apache2-fd5c2141241b3a3d2953b0e22184e25a93ea4d25.zip |
Make sure when adding a warning, that we don't duplicate an existing warning.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808656 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/cache/cache_util.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index 73cf7b8951..ad838db1b1 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -349,6 +349,7 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, char *val; apr_time_t age_c = 0; cache_info *info = &(h->cache_obj->info); + const char *warn_head; cache_server_conf *conf = (cache_server_conf *)ap_get_module_config(r->server->module_config, &cache_module); @@ -511,7 +512,6 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, ((smaxage == -1) && (maxage == -1) && (info->expire != APR_DATE_BAD) && (age < (apr_time_sec(info->expire - info->date) + maxstale - minfresh)))) { - const char *warn_head; warn_head = apr_table_get(h->resp_hdrs, "Warning"); @@ -598,8 +598,15 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, "Cache already locked for stale cached URL, " "pretend it is fresh: %s", r->unparsed_uri); - apr_table_merge(h->resp_hdrs, "Warning", + + /* make sure we don't stomp on a previous warning */ + warn_head = apr_table_get(h->resp_hdrs, "Warning"); + if ((warn_head == NULL) || + ((warn_head != NULL) && (ap_strstr_c(warn_head, "110") == NULL))) { + apr_table_merge(h->resp_hdrs, "Warning", "110 Response is stale"); + } + return 1; } else { |