(tomcat) branch 10.1.x updated: Another instance of user agent matching

[email protected] Fri, 31 Jul 2026 12:03:52 +0000
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <178549943210.4117518.6022220818362832463@gitbox3-he-fi.apache.org>
This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 6bec3ebbe0 Another instance of user agent matching
6bec3ebbe0 is described below

commit 6bec3ebbe0436fadebefb31d80c2161c06609120
Author: remm <[email protected]>
AuthorDate: Fri Jul 31 14:01:15 2026 +0200

    Another instance of user agent matching
---
 java/org/apache/catalina/valves/CrawlerSessionManagerValve.java | 2 +-
 webapps/docs/changelog.xml                                      | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
index 32d9fe83cd..182f45674d 100644
--- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
+++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
@@ -248,7 +248,7 @@ public class CrawlerSessionManagerValve extends ValveBase {
                     log.trace(request.hashCode() + ": UserAgent=" + uaHeader);
                 }
 
-                if (uaPattern != null && uaPattern.matcher(uaHeader).matches()) {
+                if (uaPattern != null && uaPattern.matcher(uaHeader).find()) {
                     isBot = true;
 
                     if (log.isTraceEnabled()) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 00626e9fd4..4210dbfddd 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,13 @@
         attribute is not available or not configured for the current user.
         (markt)
       </fix>
+      <fix>
+        Fix matching the crawler user-agents of
+        <code>CrawlerSessionManagerValve</code> with patterns of the style
+        of the default
+        <code>.*[bB]ot.*|.*Yahoo! Slurp.*|.*Feedfetcher-Google.*</code>
+        pattern and documentation. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">