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

Issue #9906 Empty path info #9907

Merged
merged 3 commits into from
Jun 15, 2023
Merged

Conversation

janbartel
Copy link
Contributor

Closes #9906

When using ContextHandler.setAllowNullPathInfo(true) a URL like /ctx is not redirected to /ctx/. In older versions of jetty, the resulting path in context of "" is forced to be / and is thus sent on to whatever servlet matches that (usually the default servlet). In jetty-12 we do not fake the path to be / and we were returning a 404.

This PR allows the path in context of "" to match the same servlet as does a path in context of /.

However, unlike previous versions of jetty, we do not force the path in context to be /, the path in context will continue to be "". To do the forcing would impose extra processing on the critical path of handling a request that isn't justified by this edge-case. If skipping the redirect of /ctx to /ctx/ is desired and the application wants the path in context to be /, then the RewriteHandler can be used to rewrite /ctx to /ctx/ before the request hits the ServletContextHandler.

@janbartel janbartel added the Bug For general bugs on Jetty side label Jun 13, 2023
@janbartel janbartel self-assigned this Jun 13, 2023
@janbartel janbartel requested a review from joakime June 14, 2023 12:25
Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except minor change

janbartel and others added 2 commits June 15, 2023 12:12
…ee10/servlet/ServletContextHandlerTest.java

Co-authored-by: Olivier Lamy <[email protected]>
…9/servlet/ServletContextHandlerTest.java

Co-authored-by: Olivier Lamy <[email protected]>
@janbartel janbartel merged commit 6996446 into jetty-12.0.x Jun 15, 2023
@janbartel janbartel deleted the jetty-12.0.x-9906-nullpathinfo branch June 15, 2023 10:13
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants