Open
Conversation
seanmonstar
reviewed
Feb 10, 2026
tower-http/Cargo.toml
Outdated
| catch-panic = ["tracing", "futures-util/std", "dep:http-body", "dep:http-body-util"] | ||
| cors = [] | ||
| follow-redirect = ["futures-util", "dep:http-body", "iri-string", "tower/util"] | ||
| follow-redirect = ["futures-util", "dep:http-body", "url", "tower/util"] |
Collaborator
There was a problem hiding this comment.
Suggested change
| follow-redirect = ["futures-util", "dep:http-body", "url", "tower/util"] | |
| follow-redirect = ["futures-util", "dep:http-body", "dep:url", "tower/util"] |
tesaguri
reviewed
Feb 10, 2026
| Uri::try_from(uri).ok() | ||
| let base_url = Url::parse(&base.to_string()).ok()?; | ||
| let resolved = base_url.join(relative).ok()?; | ||
| resolved.as_str().parse().ok() |
Contributor
There was a problem hiding this comment.
Suggested change
| resolved.as_str().parse().ok() | |
| Uri::try_from(String::from(resolved)).ok() |
(requires use std::convert::TryFrom; again)
parse incurs additional allocation.
Author
|
I've updated the PR with the suggested changes: switched |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Hi there! I’m interested in helping out with #630.
I've swapped iri-string for url in the follow-redirect module as it seems to be the most robust way to handle non-ASCII characters in redirects. I'd appreciate any feedback on the approach.
Solution
iri-stringwithurlcrate in follow-redirect featureresolve_uri()function implementationiri-stringdependencyTesting
Added
test_resolve_uri_unicode()that verifies: