Repository navigation
🐛 fix(url): resolve foreign special links to host - #2268
Merged
gaborbernat merged 5 commits intoNov 16, 2026
Merged
Conversation
A link whose scheme is a different special scheme from the base, with extra slashes before its host, such as ftp:///host/path, came back from resolve_links() exactly as written. A browser skips the extra slashes and reads the host after them, so the link named a host the resolved URL did not. The link join now reads that host for any special scheme other than file, and the extract fast path sends such links through the join. Fixes tox-dev#2250.
The bitwise test raised -Wparentheses under -Werror. Each slash test is now a parenthesized pair, so the outcome is unchanged.
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.
Node.resolve_links()returned a link with a different special scheme and extra slashes before its host, such asftp:///example.com/p, exactly as written, so the resolved link named a host the browser would not open (#2250). Fixes #2250. 🔗 Once this merges, such links resolve to the host they name.The link join read the host of a special-scheme reference only when the reference used the base's scheme. For a different scheme the join took the reference as absolute and returned it unchanged (RFC 3986 section 5.2.2), and the extract fast path skipped the join for the same reason (the old check at the merge base). A browser parses such a reference with the special authority rule, which does not depend on the base and skips every slash after the two that open the authority (special authority ignore slashes state).
The join now reads the host after the extra slashes for any special scheme other than
file(the new check), and the fast path sends those references through the join (the new predicate).Behavior changes
Node.resolve_links()resolves a link with a different special scheme and extra slashes to the host it names. Before, the link was returned as written.ftp:///, is still returned as written.//, are unchanged.