Skip to content

Normalize @authority according to RFC 9421 - #44

Open
jeremy-cxf wants to merge 2 commits into
yaronf:mainfrom
jeremy-cxf:jcocks/normalize-authority
Open

jeremy-cxf wants to merge 2 commits into
yaronf:mainfrom
jeremy-cxf:jcocks/normalize-authority

Conversation

@jeremy-cxf

Copy link
Copy Markdown

Hello!

RFC 9421 §2.2.3 states:

The component value MUST be normalized according to the rules provided
in [HTTP], Section 4.2.3. Namely, the hostname is normalized to lowercase,
and the default port is omitted.

Currently, @authority uses the authority unchanged, contrary to the requirement. For example a HTTPS request with authority (e.g EXAMPLE.com:443 produces EXAMPLE.com:443 instead of example.com.

This change lowercases the hostname and removes port 443 for HTTPS or port 80 for HTTP, while preserving non-default ports. This will fix signature mismatches with implementations that apply the required normalization.

Lemme know if i'm off on anything, cheers!

@yaronf

yaronf commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Pushed a follow-up onto this branch (maintainer edit):

  • Refactored into canonicalAuthority using net.SplitHostPort
  • Added unit tests for case fold, default/non-default ports, and IPv6
  • Draft upgrade notes in internal-docs/RELEASE-v0.6.3.md for the cross-version behavioral change

Opened #45 for the related @scheme lowercase gap (§2.2.4).

Co-authored-by: Cursor <cursoragent@cursor.com>

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.

2 participants