You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2002/02/11 22:15:19 UTC

cvs commit: apache-1.3/src/modules/proxy proxy_cache.c proxy_http.c proxy_util.c

minfrin     02/02/11 13:15:19

  Modified:    src      CHANGES
               src/include hsregex.h
               src/modules/proxy proxy_cache.c proxy_http.c proxy_util.c
  Log:
  Corrected the use of ap_table_set and ap_table_merge:
  - Fix a problem with proxy where each entry of a duplicated
  header such as Set-Cookie would overwrite and obliterate the
  previous value of the header, resulting in multiple header
  values (like cookies) going missing.
  - Fix a problem with proxy where X-Cache headers were
  overwriting and then obliterating upstream X-Cache headers
  from other proxies.
  
  Revision  Changes    Path
  1.1772    +12 -0     apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1771
  retrieving revision 1.1772
  diff -u -r1.1771 -r1.1772
  --- CHANGES	9 Feb 2002 14:51:29 -0000	1.1771
  +++ CHANGES	11 Feb 2002 21:15:18 -0000	1.1772
  @@ -1,4 +1,16 @@
   Changes with Apache 1.3.24
  +
  +  *) Fix a problem with proxy where each entry of a duplicated
  +     header such as Set-Cookie would overwrite and obliterate the
  +     previous value of the header, resulting in multiple header
  +     values (like cookies) going missing.
  +     [Graham Leggett, Joshua Slive]
  +
  +  *) Fix a problem with proxy where X-Cache headers were
  +     overwriting and then obliterating upstream X-Cache headers
  +     from other proxies.
  +     [Graham Leggett, Jacob Rief <ja...@tiscover.com>]
  +
     *) Win32: Work around a bug in Windows XP that caused data
        corruption on writes to the network. The WinXP bug
        is tickled by the combined use of WSADuplicateSocket 
  
  
  
  1.16      +1 -3      apache-1.3/src/include/hsregex.h
  
  Index: hsregex.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/include/hsregex.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- hsregex.h	25 Sep 2000 23:48:24 -0000	1.15
  +++ hsregex.h	11 Feb 2002 21:15:19 -0000	1.16
  @@ -16,12 +16,10 @@
   #endif
   #endif
   
  -#ifndef ap_private_extern
  -#if defined(DARWIN)
  +#if defined(MAC_OS) || defined(MAC_OS_X_SERVER)
   #define ap_private_extern __private_extern__
   #else
   #define ap_private_extern
  -#endif
   #endif
   
   typedef off_t regoff_t;
  
  
  
  1.77      +4 -2      apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- proxy_cache.c	18 Jan 2002 20:26:58 -0000	1.76
  +++ proxy_cache.c	11 Feb 2002 21:15:19 -0000	1.77
  @@ -878,7 +878,8 @@
   
       /* Prepare and send headers to client */
       ap_overlap_tables(r->headers_out, c->hdrs, AP_OVERLAP_TABLES_SET);
  -    ap_table_setn(r->headers_out, "X-Cache", c->xcache);
  +    /* make sure our X-Cache header does not stomp on a previous header */
  +    ap_table_mergen(r->headers_out, "X-Cache", c->xcache);
       r->content_type = ap_table_get(r->headers_out, "Content-Type");
       ap_send_http_header(r);
   
  @@ -1210,7 +1211,8 @@
           if (!( (-1 < smaxage && age < smaxage) ||
                (-1 < maxage && age < maxage) ||
                (c->expire != BAD_DATE && (c->expire - c->date) > age) )) {
  -            ap_table_set(c->hdrs, "Warning", "110 Response is stale");
  +            /* make sure we don't stomp on a previous warning */
  +            ap_table_merge(c->hdrs, "Warning", "110 Response is stale");
           }
   
           /* check conditionals (If-Modified-Since, etc) */
  
  
  
  1.82      +5 -2      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- proxy_http.c	20 Jan 2002 20:14:37 -0000	1.81
  +++ proxy_http.c	11 Feb 2002 21:15:19 -0000	1.82
  @@ -485,6 +485,9 @@
        * HTTP/1.1 requires us to accept 3 types of dates, but only generate
        * one type
        */
  +    /* we SET the dates here, obliterating possible multiple dates, as only
  +     * one of each date makes sense in each response.
  +     */
       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)
  @@ -528,8 +531,8 @@
   
       /* Setup the headers for our client from upstreams response-headers */
       ap_overlap_tables(r->headers_out, resp_hdrs, AP_OVERLAP_TABLES_SET);
  -    /* Add X-Cache header */
  -    ap_table_setn(r->headers_out, "X-Cache",
  +    /* Add X-Cache header - be careful not to obliterate any upstream headers */
  +    ap_table_mergen(r->headers_out, "X-Cache",
                     ap_pstrcat(r->pool, "MISS from ",
                                ap_get_server_name(r), NULL));
       /* The Content-Type of this response is the upstream one. */
  
  
  
  1.102     +2 -1      apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- proxy_util.c	18 Jan 2002 20:26:58 -0000	1.101
  +++ proxy_util.c	11 Feb 2002 21:15:19 -0000	1.102
  @@ -475,7 +475,8 @@
           for (end = &value[strlen(value)-1]; end > value && ap_isspace(*end); --end)
               *end = '\0';
   
  -        ap_table_add(resp_hdrs, buffer, value);
  +        /* make sure we merge so as not to destroy duplicated headers */
  +        ap_table_merge(resp_hdrs, buffer, value);
   
           /* the header was too long; at the least we should skip extra data */
           if (len >= size - 1) { 
  
  
  

Re: cvs commit: apache-1.3/src/modules/proxy proxy_cache.c proxy_http.c proxy_util.c

Posted by Graham Leggett <mi...@sharp.fm>.
minfrin@apache.org wrote:

>   1.16      +1 -3      apache-1.3/src/include/hsregex.h
> 
>   Index: hsregex.h
>   ===================================================================
>   RCS file: /home/cvs/apache-1.3/src/include/hsregex.h,v
>   retrieving revision 1.15
>   retrieving revision 1.16
>   diff -u -r1.15 -r1.16
>   --- hsregex.h 25 Sep 2000 23:48:24 -0000      1.15
>   +++ hsregex.h 11 Feb 2002 21:15:19 -0000      1.16
>   @@ -16,12 +16,10 @@
>    #endif
>    #endif
> 
>   -#ifndef ap_private_extern
>   -#if defined(DARWIN)
>   +#if defined(MAC_OS) || defined(MAC_OS_X_SERVER)
>    #define ap_private_extern __private_extern__
>    #else
>    #define ap_private_extern
>   -#endif
>    #endif
> 
>    typedef off_t regoff_t;

Very odd - no idea how this got into the commit - my apache-1.3 tree was
checked out about 30 minutes ago.

Anyone know where this is from?

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm		"There's a moon
					over Bourbon Street
						tonight..."