You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/07/07 00:15:55 UTC

[PATCH] PR#813,814: obscure proxy stuff

First problem; if a client sends a Host: header with a different case than
"Host:", the proxy won't see it and it will end up with two headers.

Second problem, if you connect to a HTTP/0.9 server, the first line
returned will be corrupt because len was tampered with.

Both solutions provided by the submitter. 

Index: modules/proxy/proxy_http.c
===================================================================
RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
retrieving revision 1.19
diff -c -r1.19 proxy_http.c
*** proxy_http.c	1997/06/16 19:32:53	1.19
--- proxy_http.c	1997/07/06 22:11:50
***************
*** 260,266 ****
      for (i=0; i < reqhdrs_arr->nelts; i++)
      {
  	if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
! 	  || !strcmp(reqhdrs[i].key, "Host"))	/* already sent if there */
  	    continue;
  	bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL);
      }
--- 260,266 ----
      for (i=0; i < reqhdrs_arr->nelts; i++)
      {
  	if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
! 	  || !strcasecmp(reqhdrs[i].key, "Host"))  /* already sent if there */
  	    continue;
  	bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL);
      }
***************
*** 331,339 ****
   * one type
   */
      
-     len = resp_hdrs->nelts;
      hdr = (struct hdr_entry *)resp_hdrs->elts;
!     for (i=0; i < len; i++)
      {
  	if (hdr[i].value[0] == '\0') continue;
  	p = hdr[i].field;
--- 331,338 ----
   * one type
   */
      
      hdr = (struct hdr_entry *)resp_hdrs->elts;
!     for (i=0; i < resp_hdrs->nelts; i++)
      {
  	if (hdr[i].value[0] == '\0') continue;
  	p = hdr[i].field;
***************
*** 371,378 ****
  	    cache = proxy_cache_error(c);
  
  /* send headers */
!     len = resp_hdrs->nelts;
!     for (i=0; i < len; i++)
      {
  	if (hdr[i].field == NULL || hdr[i].value == NULL ||
  	    hdr[i].value[0] == '\0') continue;
--- 370,376 ----
  	    cache = proxy_cache_error(c);
  
  /* send headers */
!     for (i=0; i < resp_hdrs->nelts; i++)
      {
  	if (hdr[i].field == NULL || hdr[i].value == NULL ||
  	    hdr[i].value[0] == '\0') continue;


Re: [PATCH] PR#813,814: obscure proxy stuff

Posted by Marc Slemko <ma...@worldgate.com>.
On Mon, 7 Jul 1997, Dean Gaudet wrote:

> Looks fine to me ... +1
> 
> Should I start keeping a 1.2.2 status?

No, that will make us release a 1.2.2.  

I see little happening on 1.3 other than a few people who do NT stuff and 
other unrelated patches from people sitting twiddling their thumbs.

I see nothing happening on 2.0.

I see too much happening on 1.2.

Sigh.  So I guess that's a yes, a 1.2.2 status will probably become
a good idea.


Re: [PATCH] PR#813,814: obscure proxy stuff

Posted by Dean Gaudet <dg...@arctic.org>.
Looks fine to me ... +1

Should I start keeping a 1.2.2 status?

Dean

On Sun, 6 Jul 1997, Marc Slemko wrote:

> First problem; if a client sends a Host: header with a different case than
> "Host:", the proxy won't see it and it will end up with two headers.
> 
> Second problem, if you connect to a HTTP/0.9 server, the first line
> returned will be corrupt because len was tampered with.
> 
> Both solutions provided by the submitter. 
> 
> Index: modules/proxy/proxy_http.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
> retrieving revision 1.19
> diff -c -r1.19 proxy_http.c
> *** proxy_http.c	1997/06/16 19:32:53	1.19
> --- proxy_http.c	1997/07/06 22:11:50
> ***************
> *** 260,266 ****
>       for (i=0; i < reqhdrs_arr->nelts; i++)
>       {
>   	if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
> ! 	  || !strcmp(reqhdrs[i].key, "Host"))	/* already sent if there */
>   	    continue;
>   	bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL);
>       }
> --- 260,266 ----
>       for (i=0; i < reqhdrs_arr->nelts; i++)
>       {
>   	if (reqhdrs[i].key == NULL || reqhdrs[i].val == NULL
> ! 	  || !strcasecmp(reqhdrs[i].key, "Host"))  /* already sent if there */
>   	    continue;
>   	bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, "\015\012", NULL);
>       }
> ***************
> *** 331,339 ****
>    * one type
>    */
>       
> -     len = resp_hdrs->nelts;
>       hdr = (struct hdr_entry *)resp_hdrs->elts;
> !     for (i=0; i < len; i++)
>       {
>   	if (hdr[i].value[0] == '\0') continue;
>   	p = hdr[i].field;
> --- 331,338 ----
>    * one type
>    */
>       
>       hdr = (struct hdr_entry *)resp_hdrs->elts;
> !     for (i=0; i < resp_hdrs->nelts; i++)
>       {
>   	if (hdr[i].value[0] == '\0') continue;
>   	p = hdr[i].field;
> ***************
> *** 371,378 ****
>   	    cache = proxy_cache_error(c);
>   
>   /* send headers */
> !     len = resp_hdrs->nelts;
> !     for (i=0; i < len; i++)
>       {
>   	if (hdr[i].field == NULL || hdr[i].value == NULL ||
>   	    hdr[i].value[0] == '\0') continue;
> --- 370,376 ----
>   	    cache = proxy_cache_error(c);
>   
>   /* send headers */
> !     for (i=0; i < resp_hdrs->nelts; i++)
>       {
>   	if (hdr[i].field == NULL || hdr[i].value == NULL ||
>   	    hdr[i].value[0] == '\0') continue;
> 
>