You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Romain Bourgue <ro...@agriculture.gouv.fr> on 2006/01/08 17:12:41 UTC

[patch] 2.0.55 mod_proxy_http and pre-existing headers_out

hi,

First of all, this is my first patch submission ever, so, apologies for 
any mistakes I could have done...

It's been discussed before (#10722 and 
http://hypermail.linklord.com/new-httpd/2004/Jun/5405.html ), but, 
AFAICS the pre-existing headers_out are overwritten by mod_proxy_http in 
2.0.55 (See #25543).

I wrote a patch to fix this in 2.0.55 (see follow).

I was trying to adapt it to 2.2, when I realised that 2.2 already keeps 
the "Set-Cookies" in headers-out using a "save_table".
My question is :
Why do we only preserve "Set-Cookies" in headers_out...? If, for any 
particular needs, a pre-acting module needs to send a particular header 
to a client, despite the proxy, shouldn't we take care of that ?
Of course, if not handled correctly, this could lead to boggus duplicate 
headers...

Therefore, do I need to change my patch so that it only keeps 
'Set-cookie' header ?

Romain Bourgue

--Patch for #10722 :--

--- proxy_http.c.old    2006-01-07 19:37:12.000000000 +0100
+++ proxy_http.c        2006-01-07 19:43:08.000000000 +0100
@@ -1304,8 +1304,9 @@
              /* N.B. for HTTP/1.0 clients, we have to fold line-wrapped 
headers*/
              /* Also, take care with headers with multiple occurences. */

-            r->headers_out = ap_proxy_read_headers(r, rp, buffer,
-                                                   sizeof(buffer), origin);
+           /* Keep the possibly pre-existing headers (pre-mod_proxy) */
+            apr_table_overlap(r->headers_out,ap_proxy_read_headers(r, 
rp, buffer,
+                             sizeof(buffer), 
origin),APR_OVERLAP_TABLES_MERGE);
              if (r->headers_out == NULL) {
                  ap_log_error(APLOG_MARK, APLOG_WARNING, 0,
                               r->server, "proxy: bad HTTP/%d.%d header "