Skip to content

std.http: an https URL's explicit port is the port connected to (#2648) - #2666

Merged
ehartford merged 1 commit into
fix-1146from
fix-2648
Oct 25, 2026
Merged

ehartford merged 1 commit into
fix-1146from
fix-2648

Conversation

@ehartford

@ehartford ehartford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: http_parse_url (lib/std/http.w) fixed port = 443 and took
everything from https:// to the first / as the host, so
https://127.0.0.1:8443/ connected to host 127.0.0.1:8443 on 443, failed,
and gave status -1.

host:port and [v6]:port split (RFC 3986 authority); a port outside
1..65535 refuses the URL.

Test: test/behavior/behav_2648_https_url_port.w (a loopback listener on an
ephemeral port must hear the ClientHello; with the installed compiler it
hears only the poke that frees its accept).

Closes #2648

Root cause: http_parse_url (lib/std/http.w) fixed `port = 443` and took
everything from `https://` to the first `/` as the host, so
`https://127.0.0.1:8443/` connected to host `127.0.0.1:8443` on 443, failed,
and gave status -1.

`host:port` and `[v6]:port` split (RFC 3986 authority); a port outside
1..65535 refuses the URL.

Test: test/behavior/behav_2648_https_url_port.w (a loopback listener on an
ephemeral port must hear the ClientHello; with the installed compiler it
hears only the poke that frees its accept).
@ehartford
ehartford added this pull request to stack #2668 October 25, 2026 22:01
@ehartford ehartford changed the title fix 2648 std.http: an https URL's explicit port is the port connected to (#2648) Oct 25, 2026
@ehartford
ehartford marked this pull request as ready for review October 25, 2026 22:13
@ehartford
ehartford merged commit 96db7c9 into main Oct 25, 2026
@ehartford
ehartford deleted the fix-2648 branch October 25, 2026 22:14
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.

std.http: an explicit port in an https URL is ignored (host becomes 'host:port', port stays 443)

1 participant