You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2002/09/05 16:19:20 UTC

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

jim         2002/09/05 07:19:19

  Modified:    src      CHANGES
               src/modules/proxy proxy_cache.c
  Log:
  When the cache would validate 304 responses from back-end server, it would
  incorrectly set the content-length value to 0 (from the 304 response)
  instead of keeping the original value.
  
  PR: Bugz 10128
  Submitted by:	Paul Terry <pa...@gmx.net> and  ast@domdv.de
  
  Revision  Changes    Path
  1.1848    +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1847
  retrieving revision 1.1848
  diff -u -r1.1847 -r1.1848
  --- CHANGES	4 Sep 2002 14:29:12 -0000	1.1847
  +++ CHANGES	5 Sep 2002 14:19:18 -0000	1.1848
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3.27
   
  +  *) The cache in mod_proxy was incorrectly updating the Content-Length
  +     value (to 0) from 304 responses when doing validation. Bugz#10128
  +     [Paul Terry <pa...@gmx.net>, ast@domdv.de, Jim Jagielski]
  +
     *) Added support for Berkeley-DB/4.x to mod_auth_db.
        [Martin Kraemer]
   
  
  
  
  1.88      +13 -1     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.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- proxy_cache.c	3 Jun 2002 12:28:27 -0000	1.87
  +++ proxy_cache.c	5 Sep 2002 14:19:19 -0000	1.88
  @@ -1524,7 +1524,7 @@
       if (clen == NULL)
           c->len = -1;
       else
  -        c->len = atoi(clen);
  +        c->len = ap_strtol(clen, NULL, 10);
   
   /* we have all the header information we need - write it to the cache file */
       c->version++;
  @@ -1560,6 +1560,18 @@
    */
   
           if (c->hdrs) {
  +            /* recall at this point that c->len is already set from resp_hdrs.
  +               If Content-Length was NULL, then c->len is -1, otherwise it's
  +               set to whatever the value was. */
  +            if (c->len == 0) {
  +                const char *c_clen_str;
  +                off_t c_clen;
  +                if ( (c_clen_str = ap_table_get(c->hdrs, "Content-Length")) &&
  +                   ( (c_clen = ap_strtol(c_clen_str, NULL, 10)) > 0) ) {
  +                        ap_table_set(resp_hdrs, "Content-Length", c_clen_str);
  +                        c->len = c_clen;
  +                }
  +            }
               if (!ap_proxy_table_replace(c->hdrs, resp_hdrs)) {
                   c->xcache = ap_pstrcat(r->pool, "HIT from ", ap_get_server_name(r), " (with revalidation)", NULL);
                   return ap_proxy_cache_conditional(r, c, c->fp);