diff options
author | Eric Covener <covener@apache.org> | 2012-02-02 16:43:41 +0100 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2012-02-02 16:43:41 +0100 |
commit | 38982673f266a10ac1da736198aa83adb8b3b3c1 (patch) | |
tree | d2fdf96e5a69b78ff2483215b785c3cb526836f8 /modules | |
parent | Rebuilds various other modifications from the last few days. (diff) | |
download | apache2-38982673f266a10ac1da736198aa83adb8b3b3c1.tar.xz apache2-38982673f266a10ac1da736198aa83adb8b3b3c1.zip |
treat a rewriterule substitution that expands to "-" as if the rule
had a literal "-".
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1239679 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mappers/mod_rewrite.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 8f5d3972ed..2e285bbeb8 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3909,6 +3909,7 @@ static int apply_rewrite_rule(rewriterule_entry *p, rewrite_ctx *ctx) char *newuri = NULL; request_rec *r = ctx->r; int is_proxyreq = 0; + int force_no_sub = 0; ctx->uri = r->filename; @@ -4022,6 +4023,11 @@ static int apply_rewrite_rule(rewriterule_entry *p, rewrite_ctx *ctx) newuri = do_expand(p->output, ctx, p); rewritelog((r, 2, ctx->perdir, "rewrite '%s' -> '%s'", ctx->uri, newuri)); + /* Allow a substitution to resolve to "-" and act like a literal "-" */ + if (newuri && *newuri == '-' && !newuri[1]) { + newuri = NULL; + force_no_sub = 1; + } } /* expand [E=var:val] and [CO=<cookie>] */ @@ -4029,7 +4035,7 @@ static int apply_rewrite_rule(rewriterule_entry *p, rewrite_ctx *ctx) do_expand_cookie(p->cookie, ctx); /* non-substitution rules ('RewriteRule <pat> -') end here. */ - if (p->flags & RULEFLAG_NOSUB) { + if (p->flags & RULEFLAG_NOSUB || force_no_sub) { force_type_handler(p, ctx); if (p->flags & RULEFLAG_STATUS) { |