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

HttpURI toURI passes all info #11468

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Feb 29, 2024

Fix #11465 and #7750
HttpURI.toURI user and fragment are retained.
Use to URI(String) constructor, as all URI constructors will parse the URI anyway.

Fix #11465 and #7750
HttpURI.toURI user and fragment are retained.
Use to URI(String) constructor, as all URI constructors will parse the URI anyway.
cowwoc

This comment was marked as duplicate.

@@ -265,8 +264,7 @@ default URI toURI()
{
try
{
String query = getQuery();
return new URI(getScheme(), null, getHost(), getPort(), getPath(), query == null ? null : UrlEncoded.decodeString(query), null);
return new URI(toString());
Copy link
Contributor

@cowwoc cowwoc Feb 29, 2024

Choose a reason for hiding this comment

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

Consider using URI.create(String) instead if you're okay with throwing IllegalArgumentException instead of RuntimeException.

Fix #11465 and #7750
HttpURI.toURI user and fragment are retained.
Use to URI(String) constructor, as all URI constructors will parse the URI anyway.
@sbordet sbordet self-requested a review February 29, 2024 16:10
@gregw gregw merged commit 56e05a9 into jetty-12.0.x Feb 29, 2024
8 checks passed
@gregw gregw deleted the fix/jetty-12.0.x/11465/HttpURI_user branch February 29, 2024 16:46
@joakime
Copy link
Contributor

joakime commented Feb 29, 2024

EEEK! This was bad!

@joakime
Copy link
Contributor

joakime commented Feb 29, 2024

The multi-parameter new URI(.....) constructors will encode the various parts before they are added to the URI.
We don't want that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

HttpURI.toURI() sets userInfo to null
4 participants