diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 10:03:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 10:03:17 +0000 |
commit | 69f568eb1183a2a1f5148e6db34a8d42e0e52ff6 (patch) | |
tree | fdeb0b5ff80273f95ce61607fc3613dff0b9a235 /modules/mappers/mod_rewrite.c | |
parent | Adding upstream version 2.4.57. (diff) | |
download | apache2-upstream.tar.xz apache2-upstream.zip |
Adding upstream version 2.4.59.upstream/2.4.59upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules/mappers/mod_rewrite.c')
-rw-r--r-- | modules/mappers/mod_rewrite.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index f93f23f..bbcc11b 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3865,8 +3865,16 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf, if (*(a2_end-1) == '?') { /* a literal ? at the end of the unsubstituted rewrite rule */ - newrule->flags |= RULEFLAG_QSNONE; - *(a2_end-1) = '\0'; /* trailing ? has done its job */ + if (newrule->flags & RULEFLAG_QSAPPEND) { + /* with QSA, splitout_queryargs will safely handle it if RULEFLAG_QSLAST is set */ + newrule->flags |= RULEFLAG_QSLAST; + } + else { + /* avoid getting a query string via inadvertent capture */ + newrule->flags |= RULEFLAG_QSNONE; + /* trailing ? has done its job, but splitout_queryargs will not chop it off */ + *(a2_end-1) = '\0'; + } } else if (newrule->flags & RULEFLAG_QSDISCARD) { if (NULL == ap_strchr(newrule->output, '?')) { @@ -4758,8 +4766,8 @@ static int hook_uri2file(request_rec *r) } if (rulestatus) { - unsigned skip_absolute = is_absolute_uri(r->filename, NULL); apr_size_t flen = r->filename ? strlen(r->filename) : 0; + unsigned skip_absolute = flen ? is_absolute_uri(r->filename, NULL) : 0; int to_proxyreq = (flen > 6 && strncmp(r->filename, "proxy:", 6) == 0); int will_escape = skip_absolute && (rulestatus != ACTION_NOESCAPE); |