Skip to content

Commit be9f2ea

Browse files
committed
Merge r1919860 from trunk:
don't merge slashes on perdir prefix Submitted by: covener Reviewed by: covener, rpluem, jorton Github: closes #473 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1920980 13f79535-47bb-0310-9956-ffa450edef68
1 parent 82736c8 commit be9f2ea

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
-*- coding: utf-8 -*-
22
Changes with Apache 2.4.63
33

4+
*) mod_rewrite: Don't require [UNC] flag to preserve a leading //
5+
added by applying the perdir prefix to the substitution.
6+
[Ruediger Pluem, Eric Covener]
7+
48
*) Windows: Restore the ability to "Include" configuration files on UNC
59
paths. PR69313 [Eric Covener]
610

modules/mappers/mod_rewrite.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4322,6 +4322,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
43224322
char *newuri = NULL;
43234323
request_rec *r = ctx->r;
43244324
int is_proxyreq = 0;
4325+
int prefix_added = 0;
43254326

43264327
ctx->uri = r->filename;
43274328

@@ -4483,6 +4484,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
44834484
newuri, ctx->perdir, newuri);
44844485

44854486
newuri = apr_pstrcat(r->pool, ctx->perdir, newuri, NULL);
4487+
prefix_added = 1;
44864488
}
44874489
else if (!(p->flags & (RULEFLAG_PROXY | RULEFLAG_FORCEREDIRECT))) {
44884490
/* Not an absolute URI-path and the scheme (if any) is unknown,
@@ -4496,6 +4498,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
44964498
newuri, newuri);
44974499

44984500
newuri = apr_pstrcat(r->pool, "/", newuri, NULL);
4501+
prefix_added = 1;
44994502
}
45004503
}
45014504

@@ -4576,7 +4579,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
45764579
return RULE_RC_MATCH;
45774580
}
45784581

4579-
if (!(p->flags & RULEFLAG_UNC)) {
4582+
if (!((p->flags & RULEFLAG_UNC) || prefix_added)) {
45804583
/* merge leading slashes, unless they were literals in the sub */
45814584
if (!AP_IS_SLASH(p->output[0]) || !AP_IS_SLASH(p->output[1])) {
45824585
while (AP_IS_SLASH(r->filename[0]) &&

0 commit comments

Comments
 (0)