From fb7f8cf93b2ba9745f6f19a21752c64f5d0dfcc6 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sun, 9 Dec 2012 13:45:56 +0000 Subject: [PATCH] Merge r1410681: * mod_rewrite: PR53963: Ad an opt-in RewriteOption to control merging of RewriteBase (This merge started happening in 2.4.0/2.2.23) Submitted by: covener Reviewed by: covener, minfrin, sf git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1418954 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ STATUS | 6 ------ docs/manual/mod/mod_rewrite.xml | 10 ++++++++++ modules/mappers/mod_rewrite.c | 11 +++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index df167f1b8e..a12c2654ca 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.4.4 + *) mod_rewrite: Stop mergeing RewriteBase down to subdirectories + unless new option 'RewriteOptions MergeBase' is configured. + PR 53963. [Eric Covener] + *) mod_status, mod_info, mod_proxy_ftp, mod_proxy_balancer, mod_imagemap, mod_ldap: Improve escaping of hostname and URIs HTML output. [Jim Jagielski, Stefan Fritsch] diff --git a/STATUS b/STATUS index f9e40e6d0c..ba69a19422 100644 --- a/STATUS +++ b/STATUS @@ -91,12 +91,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_rewrite: PR53963: Ad an opt-in RewriteOption to control merging of RewriteBase - (This merge started happening in 2.4.3/2.2.23) - trunk patch: http://svn.apache.org/viewvc?rev=1410681&view=rev - 2.4.x patch: http://people.apache.org/~covener/patches/httpd-2.4.x-rewritebase_optional.diff - +1 covener, minfrin, sf - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index 0479e5e721..066a21a153 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -220,6 +220,16 @@ later +
MergeBase
+
+ +

With this option, the value of RewriteBase is copied from where it's explicitly defined + into any sub-directory or sub-location that doesn't define its own + RewriteBase. This was the + default behavior in 2.4.0 thorugh 2.4.3, and the flag to restore it is + available Apache HTTP Server 2.4.4 and later.

+
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 9823a7fa9d..2193bfd0ee 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -191,6 +191,7 @@ static const char* really_last_key = "rewrite_really_last"; #define OPTION_INHERIT_BEFORE 1<<2 #define OPTION_NOSLASH 1<<3 #define OPTION_ANYURI 1<<4 +#define OPTION_MERGEBASE 1<<5 #ifndef RAND_MAX #define RAND_MAX 32767 @@ -2821,8 +2822,11 @@ static void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv) a->state_set = overrides->state_set || base->state_set; a->options = (overrides->options_set == 0) ? base->options : overrides->options; a->options_set = overrides->options_set || base->options_set; - a->baseurl = (overrides->baseurl_set == 0) ? base->baseurl : overrides->baseurl; - a->baseurl_set = overrides->baseurl_set || base->baseurl_set; + + if (a->options & OPTION_MERGEBASE) { + a->baseurl = (overrides->baseurl_set == 0) ? base->baseurl : overrides->baseurl; + a->baseurl_set = overrides->baseurl_set || base->baseurl_set; + } a->directory = overrides->directory; @@ -2897,6 +2901,9 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd, else if (!strcasecmp(w, "allowanyuri")) { options |= OPTION_ANYURI; } + else if (!strcasecmp(w, "mergebase")) { + options |= OPTION_MERGEBASE; + } else { return apr_pstrcat(cmd->pool, "RewriteOptions: unknown option '", w, "'", NULL); -- 2.40.0