Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetty 10.0.14 uses wrong pathSpec for request #9517

Closed
Or4ng3 opened this issue Mar 17, 2023 · 5 comments · Fixed by #9518
Closed

Jetty 10.0.14 uses wrong pathSpec for request #9517

Or4ng3 opened this issue Mar 17, 2023 · 5 comments · Fixed by #9518
Assignees
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)
Milestone

Comments

@Or4ng3
Copy link

Or4ng3 commented Mar 17, 2023

Jetty version(s)
10.0.14

Java version/vendor (use: java -version)
17

OS type/version
Doesn't matter

Description

Related to #9055

We have two servlets:

  1. "/*"
  2. "/foo/*"

Prior to Jetty 10.0.14, requests to "/foobar/something" were handled by servlet 1. After the upgrade, requests are unable to reach it.

After debugging I found that problem was related to org.eclipse.jetty.http.pathmap.PathMappings#getMatched method:

        // path = "/foobar/something"

        MappedResource<E> prefix = _prefixMap.getBest(path); // ServletPathSpec@1c0d1eaa{/foo/*}

        if (prefix != null)
        {
            MatchedPath matchedPath = prefix.getPathSpec().matched(path);     // null, since found prefix doesn't match path
            if (matchedPath != null)
                return new MatchedResource<>(prefix.getResource(), prefix.getPathSpec(), matchedPath);
        }
@Or4ng3 Or4ng3 added the Bug For general bugs on Jetty side label Mar 17, 2023
@joakime
Copy link
Contributor

joakime commented Mar 17, 2023

Oof!

This is a bad bug that somehow creeped in (don't we have unit test for this??)

@joakime joakime self-assigned this Mar 17, 2023
@joakime joakime added the Specification For all industry Specifications (IETF / Servlet / etc) label Mar 17, 2023
@joakime joakime added this to the 10.0.x milestone Mar 17, 2023
@joakime
Copy link
Contributor

joakime commented Mar 17, 2023

I am able to replicate this with a simple test case.
Checking to see how far back this issue exists for.

@joakime
Copy link
Contributor

joakime commented Mar 17, 2023

Not able to replicate in Jetty 10.0.13 or older.

joakime added a commit that referenced this issue Mar 17, 2023
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
@joakime joakime linked a pull request Mar 17, 2023 that will close this issue
@joakime
Copy link
Contributor

joakime commented Mar 17, 2023

Opened PR #9518 to address this

sbordet pushed a commit that referenced this issue Mar 20, 2023
* Fixing #9517 - bad url-pattern prefix match behavior

Fixed regression where `/foo/*` was incorrectly matching `/foobar`.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: gregw <gregw@webtide.com>
@joakime
Copy link
Contributor

joakime commented Mar 20, 2023

We've merged this into jetty-10.0.x and jetty-11.0.x and will be cutting a new release shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Specification For all industry Specifications (IETF / Servlet / etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants