Repository navigation
Use destination authority fields when navigating to a host - #652
Open
ShahadatTest wants to merge 1 commit into
Open
ShahadatTest wants to merge 1 commit into
ShahadatTest wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
The change
When URL.navigate receives a destination host, use that destination's port and userinfo, including omitted fields. Currently
https://alice:example@old.example:8443/oldnavigating to//new.example/pathbecomeshttps://alice:example@new.example:8443/path, carrying the base login and port to the new host. An explicit destination port 0 is also overwritten, and partial destination userinfo inherits missing pieces from the base.Select these fields from the same URL that supplies the host. This follows the authority replacement rule in RFC 3986 section 5.2.2. The existing host-only path/query inheritance behavior and explicit-scheme handling are retained; this is not a complete reference-resolution rewrite.
Ten regressions fail on unchanged master: string/URL destinations with omitted userinfo/port, username only, password only, explicit zero port and IPv6. They verify field values, parse/serialize round trips and input immutability. Two controls preserve the base authority for relative paths.
Full Python 3.12 tests/module doctests: 786 passed, 1 existing platform skip, 22 passing subtests. Python 3.10 URL tests/doctests: 155 passed. git diff --check passes. Other operating systems and Python versions were not run locally. This complements the already-merged normalization/address-family fixes #489/#589.
The backstory
Previous contribution: #627. The account owner requested two further useful contributions. This was found by checking how destination authority fields are selected and comparing navigation with the referenced RFC; no personal production incident is claimed. All userinfo in the tests and examples is fictional.
AI assistance
The agent investigated, implemented, tested and drafted this PR. No separate human code review is claimed.