Skip to content

Use destination authority fields when navigating to a host - #652

Open
ShahadatTest wants to merge 1 commit into
mahmoud:masterfrom
ShahadatTest:fix/navigation-authority-fields
Open

ShahadatTest wants to merge 1 commit into
mahmoud:masterfrom
ShahadatTest:fix/navigation-authority-fields

Conversation

@ShahadatTest

Copy link
Copy Markdown

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/old navigating to //new.example/path becomes https://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

  • Harness/tooling: OpenAI Codex.
  • Model(s): GPT-6-based Codex agent; exact serving identifier unavailable.
  • Original prompt: “aro 2ta koro” (“do two more”). Earlier authorization: “aro khuje tana 5ta kore felo...tana 5ta kono confiramation er dorkar nei...” (“find more and do five consecutively; no confirmation needed”).

The agent investigated, implemented, tested and drafted this PR. No separate human code review is claimed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant