]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
AJP was dropping pre-existing cookies. Use same logic
authorJim Jagielski <jim@apache.org>
Fri, 24 Oct 2008 15:01:44 +0000 (15:01 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 24 Oct 2008 15:01:44 +0000 (15:01 +0000)
as HTTP to tuck them away

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

modules/proxy/ajp_header.c

index 01115f64d84f96e57836e224866d5a34c243c310..c7797b96a5b298c4738573736bf567e12898b76f 100644 (file)
@@ -457,6 +457,11 @@ body_chunk :=
 
  */
 
+static int addit_dammit(void *v, const char *key, const char *val)
+{
+    apr_table_addn(v, key, val);
+    return 1;
+}
 
 static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
                                            request_rec *r,
@@ -493,7 +498,15 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
 
     rc = ajp_msg_get_uint16(msg, &num_headers);
     if (rc == APR_SUCCESS) {
-        r->headers_out = apr_table_make(r->pool, num_headers);
+        /* First, tuck away all already existing cookies */
+        /*
+         * Could optimize here, but just in case we want to
+         * also save other headers, keep this logic.
+         */
+        save_table = apr_table_make(r->pool, num_headers+2);
+        apr_table_do(addit_dammit, save_table, r->headers_out,
+                     "Set-Cookie", NULL);
+        r->headers_out = save_table;
     } else {
         r->headers_out = NULL;
         num_headers = 0;