osdir.com


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

[Bug 58231] RewriteCond can add "Host" to the Vary-Header


https://bz.apache.org/bugzilla/show_bug.cgi?id=58231

--- Comment #21 from Luca Toscano <toscano.luca@xxxxxxxxx> ---
A simpler variant of the patch:

Index: modules/http/http_request.c
===================================================================
--- modules/http/http_request.c (revision 1811460)
+++ modules/http/http_request.c (working copy)
@@ -523,6 +523,7 @@
                                                request_rec *r) {
     int access_status;
     request_rec *new;
+    const char *vary_header = NULL;

     if (ap_is_recursion_limit_exceeded(r)) {
         ap_die(HTTP_INTERNAL_SERVER_ERROR, r);
@@ -586,6 +587,13 @@
         if (location)
             apr_table_setn(new->headers_out, "Location", location);
     }
+
+    if (apr_table_get(r->notes, "keep-vary-header")) {
+        if((vary_header = apr_table_get(r->headers_out, "Vary"))) {
+            apr_table_setn(new->headers_out, "Vary", vary_header);
+        }
+    }
+
     new->err_headers_out = r->err_headers_out;
     new->trailers_out    = apr_table_make(r->pool, 5);
     new->subprocess_env  = rename_original_env(r->pool, r->subprocess_env);
Index: modules/mappers/mod_rewrite.c
===================================================================
--- modules/mappers/mod_rewrite.c       (revision 1811460)
+++ modules/mappers/mod_rewrite.c       (working copy)
@@ -5226,6 +5226,8 @@
                 }
             }

+            apr_table_setn(r->notes, "keep-vary-header", "");
+
             /* now initiate the internal redirect */
             rewritelog((r, 1, dconf->directory, "internal redirect with %s "
                         "[INTERNAL REDIRECT]", r->filename));

This one uses 'notes' rather than 'subprocess_env' and it is simpler. All my
tests passes, will ask some feedback to other devs about the best way to
proceed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: bugs-help@xxxxxxxxxxxxxxxx