You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Marr <gr...@alum.wpi.edu> on 2002/05/29 20:02:53 UTC

Re: [1.3] Proxy fixes and FWD: Re: [apache-modules] Setting bytes_sent in Request Record while generating all headers by myself in Apache 1.3]

At 01:30 PM 05/29/2002, Thomas Eibner wrote:
>Index: proxy_http.c
>===================================================================
>RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
>retrieving revision 1.98
>diff -u -r1.98 proxy_http.c
>--- proxy_http.c        21 Apr 2002 21:16:39 -0000      1.98
>+++ proxy_http.c        29 May 2002 17:04:38 -0000
>@@ -350,6 +350,20 @@
>       * where the original request came from.
>       */
>      ap_table_mergen(req_hdrs, "X-Forwarded-For", 
> r->connection->remote_ip);
>+    if (r->proxyreq == PROXY_PASS) {
>+        const char *buf;
>+        /* Add X-Forwarded-Host: so that upstream knows what the
>+         * original request hostname was.
>+         */
>+        if ((buf - ap_table_get(r->headers_in, "Host"))) {

I think this should be "buf =" instead of "buf -".

-- 
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


Re: [1.3] Proxy fixes and FWD: Re: [apache-modules] Setting bytes_sent in Request Record while generating all headers by myself in Apache 1.3]

Posted by Thomas Eibner <th...@stderr.net>.
On Wed, May 29, 2002 at 08:18:53PM +0200, Thomas Eibner wrote:
> On Wed, May 29, 2002 at 02:02:53PM -0400, Greg Marr wrote:
> > At 01:30 PM 05/29/2002, Thomas Eibner wrote:
> > >Index: proxy_http.c
> > >===================================================================
> > >RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
> > >retrieving revision 1.98
> > >diff -u -r1.98 proxy_http.c
> > >--- proxy_http.c        21 Apr 2002 21:16:39 -0000      1.98
> > >+++ proxy_http.c        29 May 2002 17:04:38 -0000
> > >@@ -350,6 +350,20 @@
> > >       * where the original request came from.
> > >       */
> > >      ap_table_mergen(req_hdrs, "X-Forwarded-For", 
> > > r->connection->remote_ip);
> > >+    if (r->proxyreq == PROXY_PASS) {
> > >+        const char *buf;
> > >+        /* Add X-Forwarded-Host: so that upstream knows what the
> > >+         * original request hostname was.
> > >+         */
> > >+        if ((buf - ap_table_get(r->headers_in, "Host"))) {
> > 
> > I think this should be "buf =" instead of "buf -".
> 
> Yup, and:
> 
> +        ap_table_mergen(req_hdrs, "X-Forwarded-Server", r->server_hostname
> 
> Should be r->server->server_hostname too.
> 
> But it seems that getting the Host at this point is already to late.
> buf contains the remote hostname here already.

Which was fixed by the s/-/=/, thanks Greg.

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> <http://photos.eibner.dk/>
  !(C)<http://copywrong.dk/>                  <http://apachegallery.dk/>
          Putting the HEST in .COM <http://www.hestdesign.com/>

Re: [1.3] Proxy fixes and FWD: Re: [apache-modules] Setting bytes_sent in Request Record while generating all headers by myself in Apache 1.3]

Posted by Thomas Eibner <th...@stderr.net>.
On Wed, May 29, 2002 at 02:02:53PM -0400, Greg Marr wrote:
> At 01:30 PM 05/29/2002, Thomas Eibner wrote:
> >Index: proxy_http.c
> >===================================================================
> >RCS file: /home/cvspublic/apache-1.3/src/modules/proxy/proxy_http.c,v
> >retrieving revision 1.98
> >diff -u -r1.98 proxy_http.c
> >--- proxy_http.c        21 Apr 2002 21:16:39 -0000      1.98
> >+++ proxy_http.c        29 May 2002 17:04:38 -0000
> >@@ -350,6 +350,20 @@
> >       * where the original request came from.
> >       */
> >      ap_table_mergen(req_hdrs, "X-Forwarded-For", 
> > r->connection->remote_ip);
> >+    if (r->proxyreq == PROXY_PASS) {
> >+        const char *buf;
> >+        /* Add X-Forwarded-Host: so that upstream knows what the
> >+         * original request hostname was.
> >+         */
> >+        if ((buf - ap_table_get(r->headers_in, "Host"))) {
> 
> I think this should be "buf =" instead of "buf -".

Yup, and:

+        ap_table_mergen(req_hdrs, "X-Forwarded-Server", r->server_hostname

Should be r->server->server_hostname too.

But it seems that getting the Host at this point is already to late.
buf contains the remote hostname here already.

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> <http://photos.eibner.dk/>
  !(C)<http://copywrong.dk/>                  <http://apachegallery.dk/>
          Putting the HEST in .COM <http://www.hestdesign.com/>