I *think* that the patch below is the right thing to do throughout (rather than
just in mod_cache itself):

-       always merge in any error headers *prior* to removing
        hop-by-hop.

-       always clearing the errors.

When you are passing out a cached header set. But would love to have people their feedback. As I cannot see any real difference in my testcases, nor think of a good one.

Dw.

Index: cache_util.c
===================================================================
--- cache_util.c        (revision 649162)
+++ cache_util.c        (working copy)
@@ -650,6 +650,10 @@
 {
        apr_table_t *headers_out;

+        headers_out = apr_table_overlay(r->pool, headers_out,
+                                        r->err_headers_out);
+        apr_table_clear(r->err_headers_out);
+
        headers_out = ap_cache_cacheable_headers(r->pool, r->headers_out,
                                                   r->server);

@@ -659,8 +663,5 @@
                            ap_make_content_type(r, r->content_type));
         }

-        headers_out = apr_table_overlay(r->pool, headers_out,
-                                        r->err_headers_out);
-
        return headers_out;
 }
Index: mod_cache.c
===================================================================
--- mod_cache.c (revision 649179)
+++ mod_cache.c (working copy)
@@ -757,16 +757,8 @@
          * err_headers_out and we also need to strip any hop-by-hop
          * headers that might have snuck in.
          */
-        r->headers_out = apr_table_overlay(r->pool, r->headers_out,
-                                           r->err_headers_out);
+        r->headers_out = ap_cache_cacheable_headers_out(r);

-       /* XXX check -- we're not patching up content-type - i.e. this
-         *     propably should be ap_cache_cacheable_headers_out().
-         */
- r->headers_out = ap_cache_cacheable_headers(r->pool, r- >headers_out,
-                                                     r->server);
-        apr_table_clear(r->err_headers_out);
-
/* Merge in our cached headers. However, keep any updated values. */
         ap_cache_accept_headers(cache->handle, r, 1);
     }


Reply via email to