diff options
author | Eric Covener <covener@apache.org> | 2023-06-28 12:38:27 +0200 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2023-06-28 12:38:27 +0200 |
commit | 52bf943f2f751826586d832d0a78680c17e87a6e (patch) | |
tree | db9521b0702c7b442b7c4082f5d356a7af183240 /modules/mappers | |
parent | HTTP/2 WebSockets: adding throughput tests and test client improvements (diff) | |
download | apache2-52bf943f2f751826586d832d0a78680c17e87a6e.tar.xz apache2-52bf943f2f751826586d832d0a78680c17e87a6e.zip |
act more like pre-r1908097 with rewrite
- be more conservative with setting QSNONE
- allow the query to be split as historically, but then drop r->args if QSNONE
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910650 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers')
-rw-r--r-- | modules/mappers/mod_rewrite.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 7fb4e92c0d..0ead238e64 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -806,12 +806,6 @@ static void splitout_queryargs(request_rec *r, int flags) int qsdiscard = flags & RULEFLAG_QSDISCARD; int qslast = flags & RULEFLAG_QSLAST; - if (flags & RULEFLAG_QSNONE) { - rewritelog(r, 2, NULL, "discarding query string, no parse from substitution"); - r->args = NULL; - return; - } - /* don't touch, unless it's a scheme for which a query string makes sense. * See RFC 1738 and RFC 2368. */ @@ -853,6 +847,10 @@ static void splitout_queryargs(request_rec *r, int flags) r->args[len-1] = '\0'; } } + if (flags & RULEFLAG_QSNONE) { + rewritelog(r, 2, NULL, "discarding query string, no parse from substitution"); + r->args = NULL; + } rewritelog(r, 3, NULL, "split uri=%s -> uri=%s, args=%s", olduri, r->filename, r->args ? r->args : "<none>"); @@ -3909,15 +3907,15 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf, } if (*(a2_end-1) == '?') { - *(a2_end-1) = '\0'; /* trailing ? has done its job */ - /* a literal ? at the end of the unsubstituted rewrite rule */ - if (!(newrule->flags & RULEFLAG_QSAPPEND)) - { + if (!(newrule->flags & RULEFLAG_QSAPPEND) && + !(newrule->flags & RULEFLAG_QSLAST)) { + /* Rule ends with a literal ?, make sure we don't end up with any query */ newrule->flags |= RULEFLAG_QSNONE; } } else if (newrule->flags & RULEFLAG_QSDISCARD) { if (NULL == ap_strchr(newrule->output, '?')) { + /* QSD and no literal ? in substitution, make sure we don't end up with any query */ newrule->flags |= RULEFLAG_QSNONE; } } |