You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modproxy-dev@apache.org by Ghislaine Labouret <Gh...@hsc.fr> on 2001/11/30 16:25:14 UTC
Re: mod_proxy/8724: Multiple occurences of response headers get removed by mod_proxy
On 9 Nov 2001 16:57:28 -0000, Ghislaine Labouret wrote:
> >Number: 8724
> >Category: mod_proxy
> >Synopsis: Multiple occurences of response headers get removed by mod_proxy
> >Confidential: no
> >Severity: non-critical
> >Priority: medium
> >Responsible: apache
> >State: open
> >Quarter:
> >Keywords:
> >Date-Required:
> >Class: sw-bug
> >Submitter-Id: unknown
> >Arrival-Date: Fri Nov 09 09:00:00 PST 2001
> >Closed-Date:
> >Last-Modified:
> >Originator: Ghislaine.Labouret@hsc.fr
> >Release: 1.3.22
> >Organization:
> apache
> >Environment:
> Tested on Solaris 2.6
> >Description:
> When the answer from a web server to mod_proxy includes, for exemple, several
> "Expires:" headers (I know, this is unusual...), only the first one is
> transmitted to the client by mod_proxy.
>
> The cause is in proxy_http.c, line 511&512:
> if ((datestr = ap_table_get(resp_hdrs, "Expires")) != NULL)
> ap_table_set(resp_hdrs, "Expires", ap_proxy_date_canon(p, datestr));
>
> In the above code, ap_table_get only gets the first occurence of the header,
> and ap_table_set removes all other occurences.
>
> The same problem occurs for other response headers that are modified by
> mod_proxy.
> >How-To-Repeat:
>
> >Fix:
The following patch solves the issue. Would the mod_proxy team consider
including it or somtehing to the same effect?
--- proxy_http.c-orig Mon Nov 26 19:01:35 2001
+++ proxy_http.c Fri Nov 30 18:09:39 2001
@@ -158,6 +158,29 @@
ap_table_unset(headers, "Connection");
}
+struct proxy_date_canon_parms {
+ pool *pool;
+ table *table;
+};
+
+static int proxy_date_canon(void *rec, const char *key, const char *value)
+{
+ pool *p;
+ table *new_resp_hdrs;
+
+ p = ((struct proxy_date_canon_parms *) rec)->pool;
+ new_resp_hdrs = ((struct proxy_date_canon_parms *) rec)->table;
+
+ if ( (strcasecmp(key, "Date") == 0)
+ || (strcasecmp(key, "Last-Modified") == 0)
+ || (strcasecmp(key, "Expires") == 0))
+ ap_table_add(new_resp_hdrs, key, ap_proxy_date_canon(p, value));
+ else
+ ap_table_add(new_resp_hdrs, key, value);
+
+ return 1;
+}
+
/*
* This handles http:// URLs, and other URLs using a remote proxy over http
* If proxyhost is NULL, then contact the server directly, otherwise
@@ -188,6 +211,7 @@
int destport = 0;
char *destportstr = NULL;
const char *urlptr = NULL;
+ struct proxy_date_canon_parms do_par;
const char *datestr;
struct tbl_do_args tdo;
#ifdef EAPI
@@ -504,12 +528,12 @@
* HTTP/1.0 requires us to accept 3 types of dates, but only generate
* one type
*/
- 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)
- ap_table_set(resp_hdrs, "Last-Modified", ap_proxy_date_canon(p, datestr));
- if ((datestr = ap_table_get(resp_hdrs, "Expires")) != NULL)
- ap_table_set(resp_hdrs, "Expires", ap_proxy_date_canon(p, datestr));
+ do_par.pool = p;
+ do_par.table = ap_make_table(p, 20);
+ ap_table_do((int (*)(void *, const char *, const char *))proxy_date_canon,
+ (void *) &do_par, resp_hdrs, NULL);
+ ap_clear_table(resp_hdrs);
+ resp_hdrs = do_par.table;
if ((datestr = ap_table_get(resp_hdrs, "Location")) != NULL)
ap_table_set(resp_hdrs, "Location", proxy_location_reverse_map(r, datestr));
--
Ghislaine Labouret, Network security consultant
Hervé Schauer Consultants (HSC) - http://www.hsc.fr/
Phone (+33)-141-409-700 - Fax (+33)-141-409-709
Re: mod_proxy/8724: Multiple occurences of response headers get removed
by mod_proxy
Posted by Graham Leggett <mi...@sharp.fm>.
Ghislaine Labouret wrote:
> > In the above code, ap_table_get only gets the first occurence of the header,
> > and ap_table_set removes all other occurences.
> >
> > The same problem occurs for other response headers that are modified by
> > mod_proxy.
> > >How-To-Repeat:
> >
> > >Fix:
>
> The following patch solves the issue. Would the mod_proxy team consider
> including it or somtehing to the same effect?
What does RFC2616 (etc) say about duplicated Date, Expires and
Last-Modified headers?
I can't see an application for having more than one of these headers in
a request - is the current proxy behavior (reducing many occurences to
one occurence) not the correct behavior?
Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."
Re: mod_proxy/8724: Multiple occurences of response headers get removed
by mod_proxy
Posted by Graham Leggett <mi...@sharp.fm>.
Ghislaine Labouret wrote:
> > In the above code, ap_table_get only gets the first occurence of the header,
> > and ap_table_set removes all other occurences.
> >
> > The same problem occurs for other response headers that are modified by
> > mod_proxy.
> > >How-To-Repeat:
> >
> > >Fix:
>
> The following patch solves the issue. Would the mod_proxy team consider
> including it or somtehing to the same effect?
What does RFC2616 (etc) say about duplicated Date, Expires and
Last-Modified headers?
I can't see an application for having more than one of these headers in
a request - is the current proxy behavior (reducing many occurences to
one occurence) not the correct behavior?
Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."