summaryrefslogtreecommitdiffstats
path: root/modules/mappers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 10:00:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 10:00:10 +0000
commit3204e211a1e248154ff95b90b6a7e29cfa92069c (patch)
tree79f901498145b63bf34e9981a013f3d9b52eafc2 /modules/mappers
parentAdding upstream version 2.4.61. (diff)
downloadapache2-upstream.tar.xz
apache2-upstream.zip
Adding upstream version 2.4.62.upstream/2.4.62upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules/mappers')
-rw-r--r--modules/mappers/mod_rewrite.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 3fc2baf..f1c22e3 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -179,6 +179,7 @@ static const char* really_last_key = "rewrite_really_last";
#define RULEFLAG_ESCAPECTLS (1<<21)
#define RULEFLAG_UNSAFE_PREFIX_STAT (1<<22)
#define RULEFLAG_UNSAFE_ALLOW3F (1<<23)
+#define RULEFLAG_UNC (1<<24)
/* return code of the rewrite rule
* the result may be escaped - or not
@@ -3843,6 +3844,9 @@ static const char *cmd_rewriterule_setflag(apr_pool_t *p, void *_cfg,
else if(!strcasecmp(key, "nsafeAllow3F")) {
cfg->flags |= RULEFLAG_UNSAFE_ALLOW3F;
}
+ else if(!strcasecmp(key, "NC")) {
+ cfg->flags |= RULEFLAG_UNC;
+ }
else {
++error;
}
@@ -4462,6 +4466,16 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
return RULE_RC_MATCH;
}
+ if (!(p->flags & RULEFLAG_UNC)) {
+ /* merge leading slashes, unless they were literals in the sub */
+ if (!AP_IS_SLASH(p->output[0]) || !AP_IS_SLASH(p->output[1])) {
+ while (AP_IS_SLASH(r->filename[0]) &&
+ AP_IS_SLASH(r->filename[1])) {
+ r->filename++;
+ }
+ }
+ }
+
/* Finally remember the forced mime-type */
force_type_handler(p, ctx);