httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@worldgate.com>
Subject Re: [PATCH] PR#659: incorrect Content-Type w/mod_proxy
Date Sun, 17 Aug 1997 17:44:11 GMT
On Sun, 17 Aug 1997, Dean Gaudet wrote:

> Why not just pass request_rec *r to it, and then pick out
> r->connection->client and r->headers_out?

Because none of this stuff is documented and passing headers_out
explicitly makes it obvious that it mucks with it.  I guess I could go for
that.  Yea, ok, I could document what the function is for and does and
just pass the request_rec to it.

> 
> Otherwise +1.
> 
> Dean
> 
> On Sun, 17 Aug 1997, Marc Slemko wrote:
> 
> > Any log entries based on proxy requests will have bogus values
> > for headers like Content-Type because they aren't set properly by
> > the proxy module when it sends the response.
> > 
> > In the PR, Brian mentions it being a problem with ProxyRemote, but it is a
> > problem with all proxy requests.
> > 
> > What this patch does is take each place where mod_proxy sends out
> > headers to the client and sets them in r->headers_out at the same
> > time.  It is arguable that things shouldn't be done this way,
> > but there isn't a better one right now.
> > 
> > Index: mod_proxy.h
> > ===================================================================
> > RCS file: /export/home/cvs/apachen/src/modules/proxy/mod_proxy.h,v
> > retrieving revision 1.17
> > diff -u -r1.17 mod_proxy.h
> > --- mod_proxy.h	1997/08/15 17:59:51	1.17
> > +++ mod_proxy.h	1997/08/17 06:35:41
> > @@ -269,7 +269,8 @@
> >  struct hdr_entry *proxy_add_header(array_header *hdrs_arr, char *field,
> >      char *value, int rep);
> >  void proxy_del_header(array_header *hdrs_arr, const char *field);
> > -void proxy_send_headers(BUFF *fp, const char *respline, array_header *hdrs_arr);
> > +void proxy_send_headers(BUFF *fp, const char *respline, 
> > +    array_header *hdrs_arr, table *headers_out);
> >  int proxy_liststr(const char *list, const char *val);
> >  void proxy_hash(const char *it, char *val,int ndepth,int nlength);
> >  int proxy_hex2sec(const char *x);
> > Index: proxy_cache.c
> > ===================================================================
> > RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
> > retrieving revision 1.22
> > diff -u -r1.22 proxy_cache.c
> > --- proxy_cache.c	1997/08/15 17:59:52	1.22
> > +++ proxy_cache.c	1997/08/17 06:35:43
> > @@ -569,7 +569,8 @@
> >  	r->status = c->status;
> >  	if (!r->assbackwards) {
> >  	    soft_timeout("proxy send headers", r);
> > -	    proxy_send_headers(r->connection->client, c->resp_line,  c->hdrs);
> > +	    proxy_send_headers(r->connection->client, c->resp_line,  
> > +	    	c->hdrs, r->headers_out);
> >  	    kill_timeout(r);
> >  	}
> >  	bsetopt(r->connection->client, BO_BYTECT, &zero);
> > @@ -799,7 +800,7 @@
> >  	    if (!r->assbackwards) {
> >  		soft_timeout("proxy send headers", r);
> >  		proxy_send_headers(r->connection->client, c->resp_line,
> > -		    c->hdrs);
> > +		    c->hdrs, r->headers_out);
> >  		kill_timeout(r);
> >  	    }
> >  	    bsetopt(r->connection->client, BO_BYTECT, &zero);
> > Index: proxy_http.c
> > ===================================================================
> > RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_http.c,v
> > retrieving revision 1.26
> > diff -u -r1.26 proxy_http.c
> > --- proxy_http.c	1997/08/15 17:59:52	1.26
> > +++ proxy_http.c	1997/08/17 06:35:46
> > @@ -394,8 +407,10 @@
> >      {
> >  	if (hdr[i].field == NULL || hdr[i].value == NULL ||
> >  	    hdr[i].value[0] == '\0') continue;
> > -	if (!r->assbackwards)
> > +	if (!r->assbackwards) {
> >  	    rvputs(r, hdr[i].field, ": ", hdr[i].value, "\015\012", NULL);
> > +	    table_set(r->headers_out, hdr[i].field, hdr[i].value);
> > +	}
> >  	if (cache != NULL)
> >  	    if (bvputs(cache, hdr[i].field, ": ", hdr[i].value, "\015\012",
> >  		       NULL) == -1)
> > Index: proxy_util.c
> > ===================================================================
> > RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v
> > retrieving revision 1.22
> > diff -u -r1.22 proxy_util.c
> > --- proxy_util.c	1997/07/27 03:13:34	1.22
> > +++ proxy_util.c	1997/08/17 06:35:49
> > @@ -516,7 +516,8 @@
> >   * A timeout should be set before calling this routine.
> >   */
> >  void
> > -proxy_send_headers(BUFF *fp, const char *respline, array_header *hdrs_arr)
> > +proxy_send_headers(BUFF *fp, const char *respline, array_header *hdrs_arr, 
> > +    table *headers_out)
> >  {
> >      struct hdr_entry *hdrs;
> >      int i;
> > @@ -529,6 +530,7 @@
> >      {
> >          if (hdrs[i].field == NULL) continue;
> >  	bvputs(fp, hdrs[i].field, ": ", hdrs[i].value, "\015\012", NULL);
> > +	table_set(headers_out, hdrs[i].field, hdrs[i].value);
> >      }
> >  
> >      bputs("\015\012", fp);
> > 
> > 
> 


Mime
View raw message