]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
incorporate feedback from rpluem
authorEric Covener <covener@apache.org>
Wed, 28 Jun 2023 14:31:25 +0000 (14:31 +0000)
committerEric Covener <covener@apache.org>
Wed, 28 Jun 2023 14:31:25 +0000 (14:31 +0000)
update comments, reverse check, force QSL

[skip ci]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910666 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 47f575b2586bcd35d76350319e6ce16c63760882..95697c911adede4e9cd91e1c67f467c3b9fb42f2 100644 (file)
@@ -3910,13 +3910,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 */
-        if (!(newrule->flags & RULEFLAG_QSAPPEND)) {
-            /* trailing ? has done its job.  with QSA, splitoutqueryargs 
-             * will handle it 
-             */ 
-            *(a2_end-1) = '\0'; 
-            newrule->flags |= RULEFLAG_QSNONE;
+        if (newrule->flags & RULEFLAG_QSAPPEND) {
+           /* with QSA, splitoutqueryargs will safely handle it if RULEFLAG_QSLAST is set */
+           newrule->flags |= RULEFLAG_QSLAST;
         }
+        else {
+            /* avoid getting a a query string via inadvertent capture */
+            newrule->flags |= RULEFLAG_QSNONE;
+            /* trailing ? has done its job, but splitoutqueryargs will not chop it off */ 
+            *(a2_end-1) = '\0'; 
+       }
     }
     else if (newrule->flags & RULEFLAG_QSDISCARD) {
         if (NULL == ap_strchr(newrule->output, '?')) {