Re: mod_cache + worker mpm + php-fpm mangling response headers on cache misses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, looks like you're right. It seems odd that we have some paths that assign r->headers_out and some that don't.

In any case, here is the updated patch. It may be worth opening this as a bug report so we can keep track of it easier.



On Wed, Sep 16, 2015 at 3:47 AM, Yann Ylavic <ylavic.dev@xxxxxxxxx> wrote:
Hi Ed,

On Tue, Sep 15, 2015 at 10:10 PM, Edward Lu <chaosed0@xxxxxxxxx> wrote:
> This looks like a bug. I believe I've tracked down the cause to a single
> errant line in the cache module; can you apply the attached patch to 2.4.x
> and see if it fixes the problem?

I think the patch would also need this hunk:

Index: modules/cache/mod_cache.c
===================================================================
--- modules/cache/mod_cache.c    (revision 1703149)
+++ modules/cache/mod_cache.c    (working copy)
@@ -1462,6 +1462,7 @@ static apr_status_t cache_save_filter(ap_filter_t
          * forward all of them to the client, including non-cacheable ones).
          */
         r->headers_out = cache_merge_headers_out(r);
+        apr_table_clear(r->err_headers_out);

         /* Merge in our cached headers.  However, keep any updated values. */
         /* take output, overlay on top of cached */
--

Otherwise we might leave this path with some headers both in
headers_out and err_headers_out.

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c
index b7454ad..070a5f0 100644
--- a/modules/cache/cache_util.c
+++ b/modules/cache/cache_util.c
@@ -1254,7 +1254,6 @@ apr_table_t *cache_merge_headers_out(request_rec *r)
 
     headers_out = apr_table_overlay(r->pool, r->headers_out,
                                     r->err_headers_out);
-    apr_table_clear(r->err_headers_out);
 
     if (r->content_type
             && !apr_table_get(headers_out, "Content-Type")) {
diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c
index b95f0a8..091d527 100644
--- a/modules/cache/mod_cache.c
+++ b/modules/cache/mod_cache.c
@@ -1452,6 +1452,7 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
          * forward all of them to the client, including non-cacheable ones).
          */
         r->headers_out = cache_merge_headers_out(r);
+        apr_table_clear(r->err_headers_out);
 
         /* Merge in our cached headers.  However, keep any updated values. */
         /* take output, overlay on top of cached */
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux