]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Corrected the use of ap_table_set and ap_table_merge:
authorGraham Leggett <minfrin@apache.org>
Mon, 11 Feb 2002 21:15:19 +0000 (21:15 +0000)
committerGraham Leggett <minfrin@apache.org>
Mon, 11 Feb 2002 21:15:19 +0000 (21:15 +0000)
- Fix a problem with proxy where each entry of a duplicated
header such as Set-Cookie would overwrite and obliterate the
previous value of the header, resulting in multiple header
values (like cookies) going missing.
- Fix a problem with proxy where X-Cache headers were
overwriting and then obliterating upstream X-Cache headers
from other proxies.
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@93364 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/include/hsregex.h
src/modules/proxy/proxy_cache.c
src/modules/proxy/proxy_http.c
src/modules/proxy/proxy_util.c

index 04b63df4ad69b5fe90bfbc0cc57e39d4d354a2c1..ca883da3affe78f80e1b40d9ef9643ed5b469600 100644 (file)
@@ -1,4 +1,16 @@
 Changes with Apache 1.3.24
+
+  *) Fix a problem with proxy where each entry of a duplicated
+     header such as Set-Cookie would overwrite and obliterate the
+     previous value of the header, resulting in multiple header
+     values (like cookies) going missing.
+     [Graham Leggett, Joshua Slive]
+
+  *) Fix a problem with proxy where X-Cache headers were
+     overwriting and then obliterating upstream X-Cache headers
+     from other proxies.
+     [Graham Leggett, Jacob Rief <jacob.rief@tiscover.com>]
+
   *) Win32: Work around a bug in Windows XP that caused data
      corruption on writes to the network. The WinXP bug
      is tickled by the combined use of WSADuplicateSocket 
index fc17aa82f7bda2c71a7977a200f5940f45dca943..1d76e5b41d3433a14210ab528e4fb1b79d445209 100644 (file)
@@ -16,13 +16,11 @@ extern "C" {
 #endif
 #endif
 
-#ifndef ap_private_extern
-#if defined(DARWIN)
+#if defined(MAC_OS) || defined(MAC_OS_X_SERVER)
 #define ap_private_extern __private_extern__
 #else
 #define ap_private_extern
 #endif
-#endif
 
 typedef off_t regoff_t;
 typedef struct {
index 10663038e478391b09b01573fc59bcc63dcd921d..2804df70f73626c9da6b75aa67989242d02b868b 100644 (file)
@@ -878,7 +878,8 @@ int ap_proxy_cache_conditional(request_rec *r, cache_req *c, BUFF *cachefp)
 
     /* Prepare and send headers to client */
     ap_overlap_tables(r->headers_out, c->hdrs, AP_OVERLAP_TABLES_SET);
-    ap_table_setn(r->headers_out, "X-Cache", c->xcache);
+    /* make sure our X-Cache header does not stomp on a previous header */
+    ap_table_mergen(r->headers_out, "X-Cache", c->xcache);
     r->content_type = ap_table_get(r->headers_out, "Content-Type");
     ap_send_http_header(r);
 
@@ -1210,7 +1211,8 @@ int ap_proxy_cache_check(request_rec *r, char *url, struct cache_conf *conf,
         if (!( (-1 < smaxage && age < smaxage) ||
              (-1 < maxage && age < maxage) ||
              (c->expire != BAD_DATE && (c->expire - c->date) > age) )) {
-            ap_table_set(c->hdrs, "Warning", "110 Response is stale");
+            /* make sure we don't stomp on a previous warning */
+            ap_table_merge(c->hdrs, "Warning", "110 Response is stale");
         }
 
         /* check conditionals (If-Modified-Since, etc) */
index 1eb522b634c53630a993557282b1ee0dbb60f947..e08b299058597ee0199dd4dafaea8078d7f797d8 100644 (file)
@@ -485,6 +485,9 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url,
      * HTTP/1.1 requires us to accept 3 types of dates, but only generate
      * one type
      */
+    /* we SET the dates here, obliterating possible multiple dates, as only
+     * one of each date makes sense in each response.
+     */
     if ((datestr = ap_table_get(resp_hdrs, "Date")) != NULL)
         ap_table_set(resp_hdrs, "Date", ap_proxy_date_canon(p, datestr));
     if ((datestr = ap_table_get(resp_hdrs, "Last-Modified")) != NULL)
@@ -528,8 +531,8 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url,
 
     /* Setup the headers for our client from upstreams response-headers */
     ap_overlap_tables(r->headers_out, resp_hdrs, AP_OVERLAP_TABLES_SET);
-    /* Add X-Cache header */
-    ap_table_setn(r->headers_out, "X-Cache",
+    /* Add X-Cache header - be careful not to obliterate any upstream headers */
+    ap_table_mergen(r->headers_out, "X-Cache",
                   ap_pstrcat(r->pool, "MISS from ",
                              ap_get_server_name(r), NULL));
     /* The Content-Type of this response is the upstream one. */
index 5fc9ac44505a2b5f79b75a1f68dc13b37b6725ab..a6575110c2893e130ea1d786d734c511330e3632 100644 (file)
@@ -475,7 +475,8 @@ table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f)
         for (end = &value[strlen(value)-1]; end > value && ap_isspace(*end); --end)
             *end = '\0';
 
-        ap_table_add(resp_hdrs, buffer, value);
+        /* make sure we merge so as not to destroy duplicated headers */
+        ap_table_merge(resp_hdrs, buffer, value);
 
         /* the header was too long; at the least we should skip extra data */
         if (len >= size - 1) {