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/07/14 13:13:39 UTC

svn commit: r1910999 - in /httpd/httpd/branches/2.4.x: changes-entries/pr66672.txt modules/mappers/mod_rewrite.c

Author: covener
Date: Fri Jul 14 13:13:38 2023
New Revision: 1910999

URL: http://svn.apache.org/viewvc?rev=1910999&view=rev
Log:
Backport rewrite changes 1910649:1910705 from trunk

PR66672 trailing ? and QSA together regression

Reviewed By: covener, gbechis, ylavic


Added:
    httpd/httpd/branches/2.4.x/changes-entries/pr66672.txt
Modified:
    httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c

Added: httpd/httpd/branches/2.4.x/changes-entries/pr66672.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/changes-entries/pr66672.txt?rev=1910999&view=auto
==============================================================================
--- httpd/httpd/branches/2.4.x/changes-entries/pr66672.txt (added)
+++ httpd/httpd/branches/2.4.x/changes-entries/pr66672.txt Fri Jul 14 13:13:38 2023
@@ -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]

Modified: httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c?rev=1910999&r1=1910998&r2=1910999&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/branches/2.4.x/modules/mappers/mod_rewrite.c Fri Jul 14 13:13:38 2023
@@ -3865,8 +3865,16 @@ 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 */
+        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, '?')) {