]> granicus.if.org Git - apache/commitdiff
Make sure when adding a warning, that we don't duplicate an existing warning.
authorGraham Leggett <minfrin@apache.org>
Thu, 27 Aug 2009 21:57:27 +0000 (21:57 +0000)
committerGraham Leggett <minfrin@apache.org>
Thu, 27 Aug 2009 21:57:27 +0000 (21:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808656 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/cache_util.c

index 73cf7b895150cf0c8567cf97e5cd3d6e122d6b95..ad838db1b14b6c903ce50a2b55e7d9d7aa4c608c 100644 (file)
@@ -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 {