]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport rewrite changes 1910649:1910705 from trunk
authorEric Covener <covener@apache.org>
Fri, 14 Jul 2023 13:13:38 +0000 (13:13 +0000)
committerEric Covener <covener@apache.org>
Fri, 14 Jul 2023 13:13:38 +0000 (13:13 +0000)
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

changes-entries/pr66672.txt [new file with mode: 0644]
modules/mappers/mod_rewrite.c

diff --git a/changes-entries/pr66672.txt b/changes-entries/pr66672.txt
new file mode 100644 (file)
index 0000000..d4c9be3
--- /dev/null
@@ -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]
index 4be51de1f4e8a4fd70ecb38a52bc2a1985f44f95..bbcc11b3c52aebefb741877fb758fd213783878c 100644 (file)
@@ -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, '?')) {