You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
std.http: an explicit port in an https URL is ignored (host becomes 'host:port', port stays 443) #2648
std.http ignores an explicit port in an https:// URL.
http_parse_url (lib/std/http.w) sets let port: i32 = 443 and takes everything from https:// to the first / as the host. For https://127.0.0.1:8443/x the host is 127.0.0.1:8443 and the port 443; tcp_connect_timeout("127.0.0.1:8443", 443, …) fails and https_get_response returns status -1, so a server on any port but 443 cannot be reached.
Repro:
use std.http
print(https_get_response_timeout("https://example.com:443/", 0, 5000, 5000).status) // -1; "https://example.com/" works
Expected: host:port splits, as RFC 3986 says ([v6]:port too); the port must be 1..65535, otherwise the URL is refused.
Found writing the #1062 regression test, whose loopback server listens on an ephemeral port.
Fixed on main by e3b0ad0 (PR #2666, stack #2668; battery green on the stack top 9f92dbb). The commit message names the root-cause line and the regression test.
Activity
std.http: an https URL's explicit port is the port connected to (#2648)…
ehartford commentedon Oct 25, 2026
Fixed on main by e3b0ad0 (PR #2666, stack #2668; battery green on the stack top 9f92dbb). The commit message names the root-cause line and the regression test.