Skip to content

Commit

Permalink
Backport rewrite changes 1910649:1910705 from trunk
Browse files Browse the repository at this point in the history
PR66672 trailing ? and QSA together regression

Reviewed By: covener, gbechis, ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1910999 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
covener committed Jul 14, 2023
1 parent 1a45d1e commit 1c8c330
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changes-entries/pr66672.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*) mod_rewrite: Fix a regression with both a trailing ? and [QSA].
in OCSP stapling. PR 66672. [Frank Meier <frank.meier ergon.ch>, covener]
12 changes: 10 additions & 2 deletions modules/mappers/mod_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, '?')) {
Expand Down

0 comments on commit 1c8c330

Please sign in to comment.