diff options
author | Eric Covener <covener@apache.org> | 2024-08-13 16:12:35 +0200 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2024-08-13 16:12:35 +0200 |
commit | c4f35264e9f30272cd12d9e9d47f0eb041d93b77 (patch) | |
tree | 94ac2b10abc073ec62d15f9ea0a879155a686b71 | |
parent | fr doc rebuild (diff) | |
download | apache2-c4f35264e9f30272cd12d9e9d47f0eb041d93b77.tar.xz apache2-c4f35264e9f30272cd12d9e9d47f0eb041d93b77.zip |
don't merge slashes on perdir prefix
Submitted by: Eric Covener
Github: closes #472
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919860 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | changes-entries/rewrite-perdir-unc.txt | 3 | ||||
-rw-r--r-- | modules/mappers/mod_rewrite.c | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/changes-entries/rewrite-perdir-unc.txt b/changes-entries/rewrite-perdir-unc.txt new file mode 100644 index 0000000000..ddc82ee800 --- /dev/null +++ b/changes-entries/rewrite-perdir-unc.txt @@ -0,0 +1,3 @@ + *) mod_rewrite: Don't require [UNC] flag to preserve a leading // + added by applying the perdir prefix to the substitution. + [Ruediger Pluem, Eric Covener] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index e250518f7b..10ba41a9b5 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -4327,6 +4327,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, char *newuri = NULL; request_rec *r = ctx->r; int is_proxyreq = 0; + int prefix_added = 0; ctx->uri = r->filename; @@ -4491,6 +4492,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, newuri, ctx->perdir, newuri); newuri = apr_pstrcat(r->pool, ctx->perdir, newuri, NULL); + prefix_added = 1; } else if (!(p->flags & (RULEFLAG_PROXY | RULEFLAG_FORCEREDIRECT))) { /* Not an absolute URI-path and the scheme (if any) is unknown, @@ -4504,6 +4506,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, newuri, newuri); newuri = apr_pstrcat(r->pool, "/", newuri, NULL); + prefix_added = 1; } } @@ -4584,7 +4587,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, return RULE_RC_MATCH; } - if (!(p->flags & RULEFLAG_UNC)) { + if (!((p->flags & RULEFLAG_UNC) || prefix_added)) { /* 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]) && |