diff --git a/changes-entries/pr66672.txt b/changes-entries/pr66672.txt new file mode 100644 index 00000000000..d4c9be3de65 --- /dev/null +++ b/changes-entries/pr66672.txt @@ -0,0 +1,2 @@ + *) mod_rewrite: Fix a regression with both a trailing ? and [QSA]. + in OCSP stapling. PR 66672. [Frank Meier , covener] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 4be51de1f4e..bbcc11b3c52 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, '?')) {