]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Approved backport. Overlay cookies as we do with 2.2 and later.
authorJim Jagielski <jim@apache.org>
Mon, 7 May 2007 11:36:24 +0000 (11:36 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 7 May 2007 11:36:24 +0000 (11:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@535856 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/proxy_http.c

diff --git a/CHANGES b/CHANGES
index 8c90ec6016634cffc84c9683bfbc291d3f2b7888..c8307d8734e35326725ee65d8d3fe79c04f15b17 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.0.60
 
+  *) proxy_http.c: Overlay existing cookies with proxied ones, ala
+     httpd-2.2. [Jim Jagielski]
+
   *) mod_proxy: ProxyTimeout (and others) ignored due to not merging
      the *_set params. PR 11540. [Jim Jagielski]
 
diff --git a/STATUS b/STATUS
index 150b9b7607ab09b4b1073b88f56e9c9ea06527c6..e39d5281bb919789048e5be1a2397399504fc5cc 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -136,11 +136,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
       Trunk: http://svn.apache.org/viewvc?view=rev&revision=442758
       +1: niq, wrowe, rpluem
 
-    * proxy_http.c: Overlay existing cookies with proxied
-      ones, ala httpd-2.2 and trunk.
-      Patch: http://people.apache.org/~jim/patches/cookie-overlay.patch
-      +1: jim, wrowe, rpluem
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ please place SVN revisions from trunk here, so it is easy to
     identify exactly what the proposed changes are!  Add all new
index 72da65f7d0ee9303b4f4154e60d78e285bf1af84..acdddaefe2f41c330fd040c26283bb1508618c85 100644 (file)
@@ -1282,6 +1282,12 @@ skip_body:
     return APR_SUCCESS;
 }
 
+static int addit_dammit(void *v, const char *key, const char *val)
+{
+    apr_table_addn(v, key, val);
+    return 1;
+}
+
 static
 apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
                                             proxy_http_conn_t *p_conn,
@@ -1296,6 +1302,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
     char keepchar;
     request_rec *rp;
     apr_bucket *e;
+    apr_table_t *save_table;
     int len, backasswards;
     int received_continue = 1; /* flag to indicate if we should
                                 * loop over response parsing logic
@@ -1372,6 +1379,11 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
             /* N.B. for HTTP/1.0 clients, we have to fold line-wrapped headers*/
             /* Also, take care with headers with multiple occurences. */
 
+            /* First, tuck away all already existing cookies */
+            save_table = apr_table_make(r->pool, 2);
+            apr_table_do(addit_dammit, save_table, r->headers_out,
+                         "Set-Cookie", NULL);
+
             r->headers_out = ap_proxy_read_headers(r, rp, buffer,
                                                    sizeof(buffer), origin);
             if (r->headers_out == NULL) {
@@ -1391,6 +1403,18 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
                 return r->status;
             }
 
+            /* Now, add in the just read cookies */
+            apr_table_do(addit_dammit, save_table, r->headers_out,
+                         "Set-Cookie", NULL);
+
+            /* and now load 'em all in */
+            if (!apr_is_empty_table(save_table)) {
+                apr_table_unset(r->headers_out, "Set-Cookie");
+                r->headers_out = apr_table_overlay(r->pool,
+                                                   r->headers_out,
+                                                   save_table);
+            }
+
             /* can't have both Content-Length and Transfer-Encoding */
             if (apr_table_get(r->headers_out, "Transfer-Encoding")
                 && apr_table_get(r->headers_out, "Content-Length")) {