]> granicus.if.org Git - apache/commitdiff
Fix processing of Connection headers in proxy
authorNick Kew <niq@apache.org>
Fri, 28 Sep 2007 18:50:57 +0000 (18:50 +0000)
committerNick Kew <niq@apache.org>
Fri, 28 Sep 2007 18:50:57 +0000 (18:50 +0000)
PR 43509

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@580457 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/mod_proxy_http.c

diff --git a/CHANGES b/CHANGES
index 810857006331eef4cbb4173650f4f4682f481f4a..ec25441ccc698446d6b4c34dee0b223a62d9da8f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_proxy_http: Correctly parse all Connection headers in proxy.
+     PR 43509 [Nick Kew]
+
   *) mod_proxy_http: add Via header correctly (if enabled) to
      response, even where other Via headers exist.
      PR 19439 [Nick Kew]
index 829b37f9996b01958b3e2a6a696d9e41087d5206..91b3274a1cb87973eaa973f8700cef4d41920bcf 100644 (file)
@@ -98,29 +98,37 @@ static int proxy_http_canon(request_rec *r, char *url)
 }
 
 /* Clear all connection-based headers from the incoming headers table */
-static void ap_proxy_clear_connection(apr_pool_t *p, apr_table_t *headers)
+typedef struct foo {
+    apr_pool_t *pool;
+    apr_table_t *table;
+} foo;
+static int clear_conn_headers(void *data, const char *key, const char *val)
 {
+    apr_table_t *headers = ((foo*)data)->table;
+    apr_pool_t *pool = ((foo*)data)->pool;
     const char *name;
-    char *next = apr_pstrdup(p, apr_table_get(headers, "Connection"));
-
-    apr_table_unset(headers, "Proxy-Connection");
-    if (!next)
-        return;
-
+    char *next = apr_pstrdup(pool, val);
     while (*next) {
         name = next;
         while (*next && !apr_isspace(*next) && (*next != ',')) {
             ++next;
         }
         while (*next && (apr_isspace(*next) || (*next == ','))) {
-            *next = '\0';
-            ++next;
+            *next++ = '\0';
         }
         apr_table_unset(headers, name);
     }
+    return 1;
+}
+static void ap_proxy_clear_connection(apr_pool_t *p, apr_table_t *headers)
+{
+    foo x;
+    x.pool = p;
+    x.table = headers;
+    apr_table_unset(headers, "Proxy-Connection");
+    apr_table_do(clear_conn_headers, &x, headers, "Connection", NULL);
     apr_table_unset(headers, "Connection");
 }
-
 static void add_te_chunked(apr_pool_t *p,
                            apr_bucket_alloc_t *bucket_alloc,
                            apr_bucket_brigade *header_brigade)