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

4.0.10: Retrieve the correct requested URI info path value, indpt of the routing path used to locate the handler #8844

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

barchetta
Copy link
Member

Backport of #8823 to 4.0.10

Description

Fixes #8818

The requested URI info logic used to fetch its path value from the incoming request path() return value. This is incorrect; that path is relative to the routing path which selected the handler, and that value has nothing to do with the path the client originally used in its outgoing request (which is what the requested URI feature is intended to reveal).

This PR changes the way the path is derived for the requested URI info to use the path from the prologue which reflects the entire path, not just the portion used in routing within the server.

It also adds a webserver test that makes sure that the path in the requested URI info is correct.

TL;DR - This bug escaped our attention until now because in 4.0.0 the server always invoked some CORS code, whether CORS was enabled or not. Part of that logic retrieved each request's requested URI info. That data is lazily created and cached. The routing that sends requests to CORS has no path prefix, so the serverRequest.path() value during the CORS-triggered handling just happened to include the entire path.

Later, when a user handler retrieved the requested URI info from the request, even though at that moment the request.path() value was relative to the routing, the cached requested URI info with the original CORS-triggered value was returned.

Beginning in 4.0.1 the server stopped invoking CORS logic unless CORS was enabled. Beginning then, the requested URI information retrieved from a user handler that used path-based routing would be incorrect, omitting the part of the path used in the routing rule.

Documentation

None

…ing path used to locate the handler (helidon-io#8823)
@barchetta barchetta added webserver backport Issues that are merged into a single branch, but missing in either master or previous release 4.x Version 4.x labels Jun 5, 2024
@barchetta barchetta added this to the 4.0.10 milestone Jun 5, 2024
@barchetta barchetta requested a review from tjquinno June 5, 2024 16:02
@barchetta barchetta self-assigned this Jun 5, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 5, 2024
@barchetta barchetta merged commit e9c1461 into helidon-io:helidon-4.0.10 Jun 5, 2024
12 checks passed
@barchetta barchetta deleted the 4.0.10-8823 branch November 12, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x backport Issues that are merged into a single branch, but missing in either master or previous release OCA Verified All contributors have signed the Oracle Contributor Agreement. webserver
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants