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

Do not decode path in EE9 Dispatcher #12796

Merged
merged 5 commits into from
Feb 28, 2025

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Feb 16, 2025

Path passed to EE9 Dispatcher is already decoded.

@gregw gregw added the Sponsored This issue affects a user with a commercial support agreement label Feb 16, 2025
@gregw gregw marked this pull request as ready for review February 24, 2025 21:39
@gregw gregw requested a review from joakime February 24, 2025 21:40
joakime
joakime previously approved these changes Feb 25, 2025
Copy link
Contributor

@joakime joakime left a comment

Choose a reason for hiding this comment

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

👍

@joakime joakime assigned joakime and gregw and unassigned joakime Feb 25, 2025
@gregw gregw requested a review from janbartel February 26, 2025 10:18
@gregw
Copy link
Contributor Author

gregw commented Feb 26, 2025

@janbartel can you triple check this for us.... I'm just a bit cautious about such changes.

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

I would prefer to change the signatures of the constructors to just pass in the context and HttpURI and then do any encoding/decoding necessary so there's no confusion. If that's not possible, then I guess this solution is probably the best we can do.

@@ -251,7 +252,7 @@ public void forward(ServletRequest servletRequest, ServletResponse response) thr
//if forwarding to the same environment we must mutate this request for Object wrapper identity
if (_targetContext.getTargetContext().getContextHandler() instanceof ContextHandler.CoreContextHandler coreContextHandler)
{
new Dispatcher(coreContextHandler.getContextHandler(), _uri, _decodedPathInContext).forward(httpServletRequest, httpServletResponse, DispatcherType.FORWARD);
new Dispatcher(coreContextHandler.getContextHandler(), _uri, URIUtil.encodePath(_decodedPathInContext)).forward(httpServletRequest, httpServletResponse, DispatcherType.FORWARD);
Copy link
Contributor

Choose a reason for hiding this comment

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

Its a bit confusing with the changing back and forth between encoded, decoded or using the uri. We could change the signature of the constructor to remove the decodedPathInContext and pass in just the context and the httpUri. From that, we can derive all the info we need, avoiding re-encoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm I think we should look at what is done in jetty-10/11 and mimic that as much as possible. Will do....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its a bit confusing with the changing back and forth between encoded, decoded or using the uri. We could change the signature of the constructor to remove the decodedPathInContext and pass in just the context and the httpUri. From that, we can derive all the info we need, avoiding re-encoding.

That's more or less what we do now in >=EE10

joakime
joakime previously approved these changes Feb 27, 2025
@gregw
Copy link
Contributor Author

gregw commented Feb 28, 2025

@janbartel nudge

janbartel
janbartel previously approved these changes Feb 28, 2025
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

A couple small things to attend to, but good otherwise.

@gregw gregw dismissed stale reviews from janbartel and joakime via aa1019f February 28, 2025 12:46
@gregw gregw requested a review from janbartel February 28, 2025 12:46
@gregw gregw merged commit 428b79b into jetty-12.0.x Feb 28, 2025
10 checks passed
@gregw gregw deleted the fix/jetty-12/ee9EncodedDispatch branch February 28, 2025 14:25
@snago snago mentioned this pull request Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsored This issue affects a user with a commercial support agreement
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants