httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Estrade Matthieu <>
Subject mod_cache and multiple brigade
Date Thu, 14 Nov 2002 11:37:35 GMT

i will quickly draw the problem i found 1 month ago:

When i am with apache + mod_proxy + mod_cache
client --> reverse_proxy_cache --> backend.

when the client ask for a document which will be handled with multiple 
brigade, the first time when mod_cache is caching the document, the 
client browser is able to display the document.
When the client ask again the document, mod_cache serve it from cache 
and the client browser refuse to display it.

I found it was because the client browser received Content-Length header 
and Transfer-Encoding=chunked header at the same time.
I put debug in mod_proxy and mod_cache, and i found:

when the backend answer the first request to multiple brigade handled 

mod_proxy: content_length=size, no transfer-encoding headers and 
r->chunked =0.
mod_proxy: delete content-length and Transfer-encoding headers.
http_protocol.c: ap_set_keepalive don't find CL or TE headers so: 
r->chunked=0 at beginning, r->chunked =1 when ending.
http_protocol.c: ap_http_header_filter find r->chunked=1 so: add header 
mod_cache: find Transfer-Encoding=chunked headers and store it in memory.
mod_cache: know the length of data he stored in memory and and the CL 
header with length of data

When the backend answer the second request to multiple brigade handled 

mod_cache:cache_out:read_ headers: read headers from what he stored in 
mod_cache:cache_out: send the two headers, CL and TE
client: refuse to display or use document he received.

On a unique brigade handled document, the ap_set_keepalive find the 
connection closed, so he don't put the r->chunked = 1 and it's working fine.
The problem is only on multiple brigade handling document

To make my mod_mem_cache work, i did this ugly patch, removing the 
TE-header from headers stored in memory.
It was working, but with ugly method.

Why mod_proxy is deleting this Content-length header, i understand for 
the TE, because the setkeepalive and http_headers_filter compute this 
header, but why the content_lentgh is deleted ?
I removed the CL deleting line in the proxy_http.c code and it's now 
working well, but i understand this line may be usefull, so i will 
search how to resolve the problem better.

i hope you understand the problem, my english is not really good


Estrade Matthieu

Modem offert : 150,92 euros remboursés sur le Pack eXtense de Wanadoo ! 
Haut débit à partir de 30 euros/mois :

View raw message