Re: (tomcat) branch main updated: Another instance of user agent matching

Rémy Maucherat <[email protected]> Fri, 31 Jul 2026 19:54:27 +0200
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <CANwj8Zp2qwc+rq6bW+tmfpcPjU4AQt95=3hi_7TemnHB3E+ptA@mail.gmail.com>
On Fri, Jul 31, 2026 at 7:22=E2=80=AFPM Mark Thomas <[email protected]> wrot=
e:
>
> On 31/07/2026 13:01, [email protected] wrote:
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > rmaucher pushed a commit to branch main
> > in repository https://gitbox.apache.org/repos/asf/tomcat.git
> >
> >
> > The following commit(s) were added to refs/heads/main by this push:
> >       new aa090e474f Another instance of user agent matching
> > aa090e474f is described below
> >
> > commit aa090e474f17207fb1b7f16a619e7d2f47e33cdf
> > Author: remm <[email protected]>
> > AuthorDate: Fri Jul 31 14:01:15 2026 +0200
> >
> >      Another instance of user agent matching
>
> This appears to do the opposite of what it states. It looks to me like
> it should be reverted. Prior to this change the docs agreed with the
> code - now they don't.

Verified. It seemed odd it would not work.

R=C3=A9my

> Mark
>
>
> > ---
> >   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 c67229d9be..4f7ef7d9fe 100644
> > --- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
> > +++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
> > @@ -249,7 +249,7 @@ public class CrawlerSessionManagerValve extends Val=
veBase {
> >                       log.trace(request.hashCode() + ": UserAgent=3D" +=
 uaHeader);
> >                   }
> >
> > -                if (uaPattern !=3D null && uaPattern.matcher(uaHeader)=
.matches()) {
> > +                if (uaPattern !=3D null && uaPattern.matcher(uaHeader)=
.find()) {
> >                       isBot =3D true;
> >
> >                       if (log.isTraceEnabled()) {
> > diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
> > index 2ebfb72332..c91d9ffaa1 100644
> > --- a/webapps/docs/changelog.xml
> > +++ b/webapps/docs/changelog.xml
> > @@ -288,6 +288,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 s=
tyle
> > +        of the default
> > +        <code>.*[bB]ot.*|.*Yahoo! Slurp.*|.*Feedfetcher-Google.*</code=
>
> > +        pattern and documentation. (remm)
> > +      </fix>
> >       </changelog>
> >     </subsection>
> >     <subsection name=3D"Coyote">
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>