Hi,

I found a problem with mod_cache and mod_proxy...

when cache is storing the data + headers in memory, it doesn't care 
about Transfert-Encoding...
So if reverse proxy receive a response by multiple brigade, with the 
header Transfert-Encoding=chunked, mod_cache store it in mobj->header_out.

When cache_out serve the document from cache, it setup the 
content-length with mobj->m_len which is the len of the file stored in 
mobj->m
So if we had before the Transfer-Encoding set up, the response contains 
now these 2 headers:

Transfer-Encoding: chunked\r\n
Content-Length: 12457 \r\n

and in case of this response, the browser refuse to display the document 
(html, gif, css...etc)
I inserted these 2 lines before copying the headers (see patch) to 
delete the Transfer-Encoding in case reverse proxy receive it.

and now, the browser receive only content length and can display the 
document.
I am not sure my dirty patch is  good because i don't know all what 
Transfer-Encoding can take as value, and all impact of this header.

regards,

Estrade Matthieu


? patch_cache
Index: mod_mem_cache.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_mem_cache.c,v
retrieving revision 1.85
diff -u -r1.85 mod_mem_cache.c
--- mod_mem_cache.c     2 Oct 2002 18:26:52 -0000       1.85
+++ mod_mem_cache.c     12 Oct 2002 14:58:46 -0000
@@ -819,6 +819,12 @@
     mem_cache_object_t *mobj = (mem_cache_object_t*) obj->vobj;
     int rc;
  
+    /* Delete Transfer-Encoding if present, coming from reverse proxy */
+    
+    if (apr_table_get(r->headers_out,"Transfer-Encoding")){
+       apr_table_unset(r->headers_out,"Transfer-Encoding");
+    }
+ 
     /*
      * The cache needs to keep track of the following information: 
      * - Date, LastMod, Version, ReqTime, RespTime, ContentLength 

Reply via email to