Skip to content

fix p3 request.set-authority rejecting ipv6 literal authorities#13739

Merged
pchickey merged 1 commit into
bytecodealliance:mainfrom
netliomax25-code:wasi-http-p3-authority-ipv6
Jun 26, 2026
Merged

fix p3 request.set-authority rejecting ipv6 literal authorities#13739
pchickey merged 1 commit into
bytecodealliance:mainfrom
netliomax25-code:wasi-http-p3-authority-ipv6

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor

Repro: in WASIp3, call request.set-authority with a bracketed IPv6 literal that has no explicit port, for example [::1] or [2001:db8::1]. The call returns an error and the authority is never set.

Cause: the validation detects whether a port was supplied with authority.contains(':') before checking that the port parses. That is also true for the colons inside an IPv6 literal host, so the later "port present but not a valid number" guard fires and a perfectly valid IPv6 authority is rejected unless a port is also appended.

Fix: look for the port only after any closing ], so colons inside the IPv6 host are not mistaken for a port. A genuinely malformed port such as example.com: or example.com:abc is still rejected. The check moved into a small parse_authority helper with unit tests for the host-name, IPv4, and bracketed IPv6 forms.

@netliomax25-code netliomax25-code requested a review from a team as a code owner June 26, 2026 14:31
@netliomax25-code netliomax25-code requested review from pchickey and removed request for a team June 26, 2026 14:31

@pchickey pchickey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have now learned something disappointing about the http::Authority parser that I had higher expectations of. Fix much appreciated.

@pchickey pchickey added this pull request to the merge queue Jun 26, 2026
Merged via the queue into bytecodealliance:main with commit f22ed39 Jun 26, 2026
52 checks passed
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