You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2023/06/27 14:33:50 UTC

svn commit: r1910633 - in /httpd/httpd/trunk: changes-entries/pr66672.txt modules/mappers/mod_rewrite.c

Author: covener
Date: Tue Jun 27 14:33:50 2023
New Revision: 1910633

URL: http://svn.apache.org/viewvc?rev=1910633&view=rev
Log:
PR66672: rewrite QSA+trailing ? regression

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>


Added:
    httpd/httpd/trunk/changes-entries/pr66672.txt
Modified:
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Added: httpd/httpd/trunk/changes-entries/pr66672.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/pr66672.txt?rev=1910633&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/pr66672.txt (added)
+++ httpd/httpd/trunk/changes-entries/pr66672.txt Tue Jun 27 14:33:50 2023
@@ -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>

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1910633&r1=1910632&r2=1910633&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Tue Jun 27 14:33:50 2023
@@ -3909,9 +3909,12 @@ static const char *cmd_rewriterule(cmd_p
     }
 
     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, '?')) {