httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r808656 - /httpd/httpd/trunk/modules/cache/cache_util.c
Date Thu, 27 Aug 2009 21:57:28 GMT
Author: minfrin
Date: Thu Aug 27 21:57:27 2009
New Revision: 808656

URL: http://svn.apache.org/viewvc?rev=808656&view=rev
Log:
Make sure when adding a warning, that we don't duplicate an existing warning.

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=808656&r1=808655&r2=808656&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Thu Aug 27 21:57:27 2009
@@ -349,6 +349,7 @@
     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 @@
         ((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 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 {



Mime
View raw message