]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR66672: rewrite QSA+trailing ? regression
authorEric Covener <covener@apache.org>
Tue, 27 Jun 2023 14:33:50 +0000 (14:33 +0000)
committerEric Covener <covener@apache.org>
Tue, 27 Jun 2023 14:33:50 +0000 (14:33 +0000)
mod_rewrite: Fix a recent regression where a rule with both a trailing
'?' and the [QSA] flag did not have the query appended.  PR66672

Submitted By: Frank Meier <frank.meier ergon.ch>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910633 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..f36897b
--- /dev/null
@@ -0,0 +1,3 @@
+  *) mod_rewrite: Fix a recent regression where a rule with both a trailing
+     '?' and the [QSA] flag did not have the query appended.  PR66672
+     Frank Meier <frank.meier ergon.ch>
index 827239d9dbf9186688aa04fd1526a03dacc49f0b..7fb4e92c0de1a9bd182009e95b3e4eed9714ee49 100644 (file)
@@ -3909,9 +3909,12 @@ 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 */
+        /* a literal ? at the end of the unsubstituted rewrite rule */
+        if (!(newrule->flags & RULEFLAG_QSAPPEND))
+        {
+            newrule->flags |= RULEFLAG_QSNONE;
+        }
     }
     else if (newrule->flags & RULEFLAG_QSDISCARD) {
         if (NULL == ap_strchr(newrule->output, '?')) {