(tomcat) branch 9.0.x updated: Ensure capture groups from RewriteCond reflect the current request

[email protected]
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 3df176f4a7 Ensure capture groups from RewriteCond reflect the current request
3df176f4a7 is described below

commit 3df176f4a74b592c9f61c329ae1be46caee40fae
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Aug 13 11:35:37 2026 +0100

    Ensure capture groups from RewriteCond reflect the current request
---
 java/org/apache/catalina/valves/rewrite/RewriteCond.java | 1 +
 webapps/docs/changelog.xml                               | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/java/org/apache/catalina/valves/rewrite/RewriteCond.java b/java/org/apache/catalina/valves/rewrite/RewriteCond.java
index b86a9723d3..0787b04f22 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteCond.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteCond.java
@@ -74,6 +74,7 @@ public class RewriteCond {
                 matcher.set(m);
                 return true;
             } else {
+                matcher.set(null);
                 return false;
             }
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0b173c1737..31bc6e521f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -118,6 +118,10 @@
         this fix, paths containing literal <code>'?'</code> characters were
         truncated. (markt)
       </fix>
+      <fix>
+        Ensure that capture groups from a <code>RewriteCond</code> always
+        reflect the result of the current request. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.