httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject cvs commit: apache-1.3/src/modules/proxy proxy_cache.c proxy_http.c proxy_util.c
Date Wed, 13 Feb 2002 05:35:02 GMT
minfrin     02/02/12 21:35:02

  Modified:    src      CHANGES
               src/modules/proxy proxy_cache.c proxy_http.c proxy_util.c
  Log:
  Some browsers ignore cookies that have been merged into a
  single Set-Cookie header. Set-Cookie and Set-Cookie2 headers
  are now unmerged in the http proxy before being sent to the
  client.
  
  Revision  Changes    Path
  1.1773    +5 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1772
  retrieving revision 1.1773
  diff -u -r1.1772 -r1.1773
  --- CHANGES	11 Feb 2002 21:15:18 -0000	1.1772
  +++ CHANGES	13 Feb 2002 05:35:02 -0000	1.1773
  @@ -1,5 +1,10 @@
   Changes with Apache 1.3.24
   
  +  *) Some browsers ignore cookies that have been merged into a
  +     single Set-Cookie header. Set-Cookie and Set-Cookie2 headers
  +     are now unmerged in the http proxy before being sent to the
  +     client. [Graham Leggett]
  +
     *) 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
  
  
  
  1.78      +7 -0      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.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- proxy_cache.c	11 Feb 2002 21:15:19 -0000	1.77
  +++ proxy_cache.c	13 Feb 2002 05:35:02 -0000	1.78
  @@ -880,7 +880,14 @@
       ap_overlap_tables(r->headers_out, c->hdrs, AP_OVERLAP_TABLES_SET);
       /* make sure our X-Cache header does not stomp on a previous header */
       ap_table_mergen(r->headers_out, "X-Cache", c->xcache);
  +
  +    /* content type is already set in the headers */
       r->content_type = ap_table_get(r->headers_out, "Content-Type");
  +
  +    /* cookies are special: they must not be merged (stupid browsers) */
  +    ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie");
  +    ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie2");
  +
       ap_send_http_header(r);
   
       /* are we rewriting the cache file? */
  
  
  
  1.83      +5 -0      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.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- proxy_http.c	11 Feb 2002 21:15:19 -0000	1.82
  +++ proxy_http.c	13 Feb 2002 05:35:02 -0000	1.83
  @@ -538,6 +538,11 @@
       /* The Content-Type of this response is the upstream one. */
       r->content_type = ap_table_get (r->headers_out, "Content-Type");
       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, r->server, "Content-Type: %s",
r->content_type);
  +
  +    /* cookies are special: they must not be merged (stupid browsers) */
  +    ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie");
  +    ap_proxy_table_unmerge(r->pool, r->headers_out, "Set-Cookie2");
  +
       /* finally output the headers to the client */
       ap_send_http_header(r);
   
  
  
  
  1.103     +30 -0     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.102
  retrieving revision 1.103
  diff -u -r1.102 -r1.103
  --- proxy_util.c	11 Feb 2002 21:15:19 -0000	1.102
  +++ proxy_util.c	13 Feb 2002 05:35:02 -0000	1.103
  @@ -69,6 +69,7 @@
   static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_word(struct dirconn_entry *This, request_rec *r);
  +void ap_proxy_table_unmerge(pool *p, table *t, char *key);
   static struct per_thread_data *get_per_thread_data(void);
   /* already called in the knowledge that the characters are hex digits */
   int ap_proxy_hex2c(const char *x)
  @@ -1438,6 +1439,35 @@
       }
   
       return q;
  +}
  +
  +/* unmerge an element in the table */
  +void ap_proxy_table_unmerge(pool *p, table *t, char *key)
  +{
  +    long int offset = 0;
  +    long int count = 0;
  +    const char *initial = ap_table_get(t, key);
  +
  +    /* get the value to unmerge */
  +    char *value = ap_pstrdup(p, initial);
  +    if (!value) {
  +        return;
  +    }
  +    
  +
  +    /* remove the value from the headers */
  +    ap_table_unset(t, key);
  +
  +    /* find each comma */
  +    while (value[count]) {
  +        if (value[count] == ',') {
  +            value[count] = 0;
  +            ap_table_add(t, key, value + offset);
  +            offset = count + 1;
  +        }
  +        count++;
  +    }
  +    ap_table_add(t, key, value + offset);
   }
   
   #if defined WIN32
  
  
  

Mime
View raw message