httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject [PATCH] proxy no workie with no-cache Bugz: 10128
Date Wed, 04 Sep 2002 20:16:48 GMT
To be folded in... Still working a problem where there's a report
of a shift-reload on Netscape results in bad mojo in the cache
(user gets a "no data" error when Apache front-ends an IIS server)

diff -u -r1.87 proxy_cache.c
--- src/modules/proxy/proxy_cache.c     3 Jun 2002 12:28:27 -0000       1.87
+++ src/modules/proxy/proxy_cache.c     4 Sep 2002 20:10:14 -0000
@@ -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, 0)) > 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);

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Mime
View raw message