Lars Eilebrecht wrote:

[...]
> So it copies r->headers_out to the local headers_out variable, and
> removes all unwanted headers. However, then r->err_headers_out
> gets merged into headers_out which is then stored in the cache.
> 
> Is there a reason why this is done? This could lead to quite a
> number of headers being stored in the cache such as Set-Cookie.
> Which happens in my case as the custom module operates on
> r->err_headers_out.
> 
> So a potential fix would be to merge r->headers_out and
> r->err_headers_out into the local headers_out variable, then
> filter the unwanted headers, and store the result.
> 
> This seems to work, but maybe I'm missing something.

Anyone any comments about this patch?
It fixes the issue, but I'm not 100% if I may be missing something
regarding the handling of err_headers_out in mod_disk_cache.

--snip--

--- mod_disk_cache.c.orig       2009-02-10 11:08:41.000000000 +0000
+++ mod_disk_cache.c    2009-02-10 10:47:48.000000000 +0000
@@ -912,7 +912,9 @@
     if (r->headers_out) {
         apr_table_t *headers_out;
 
-        headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out,
+        headers_out = apr_table_overlay(r->pool, r->headers_out,
+                                        r->err_headers_out);
+        headers_out = ap_cache_cacheable_hdrs_out(r->pool, headers_out,
                                                   r->server);
 
         if (!apr_table_get(headers_out, "Content-Type")
@@ -921,8 +923,6 @@
                            ap_make_content_type(r, r->content_type));
         }
 
-        headers_out = apr_table_overlay(r->pool, headers_out,
-                                        r->err_headers_out);
         rv = store_table(dobj->hfd, headers_out);
         if (rv != APR_SUCCESS) {
             return rv;

--snip--

ciao...
-- 
Lars Eilebrecht
l...@eilebrecht.net

Reply via email to