netliomax25-code opened PR #13686 from netliomax25-code:wasi-http-tls-server-name-ipv6 to bytecodealliance:main:
- The default outbound TLS path in p2 and p3 derives the certificate verification host name (rustls's
ServerName) withauthority.split(":").next().- An IPv6 authority is bracketed, e.g.
[2001:db8::1]:443, so that split returns[2001andServerName::try_fromrejects it. HTTPS to an IPv6 literal then always fails the handshake, even though the TCP connect uses the full authority and reaches the right peer.Pull the host out of the authority directly, dropping the brackets for the IPv6 form, in one shared helper used by both sites. Added a unit test covering host:port, IPv4, and the bracketed IPv6 forms.
netliomax25-code requested dicej for a review on PR #13686.
netliomax25-code requested wasmtime-wasi-reviewers for a review on PR #13686.
:memo: rvolosatovs submitted PR review.
:speech_balloon: rvolosatovs created PR review comment:
Could this return
ServerNamedirectly?
:speech_balloon: rvolosatovs created PR review comment:
What do you think about first trying https://doc.rust-lang.org/std/net/enum.SocketAddr.html#impl-FromStr-for-SocketAddr returning
ServerName::IpAddresson success and otherwise trying to split off the:part and passing that toServerName::try_from?
netliomax25-code updated PR #13686.
:memo: netliomax25-code submitted PR review.
:speech_balloon: netliomax25-code created PR review comment:
Done. The helper now returns ServerName<'static> directly: it parses the authority as a SocketAddr first and returns ServerName::IpAddress on success, which handles the bracketed IPv6 form, and otherwise splits off the port and hands the host to ServerName::try_from. The authority always carries a port at this point (both p2 and p3 append 443/80 when none is given), so IP literals always parse as a SocketAddr. Both call sites just map_err the result now, dropping the local ServerName import and the to_owned(). Updated the unit test to assert on the resulting ServerName.
:memo: netliomax25-code submitted PR review.
:speech_balloon: netliomax25-code created PR review comment:
Yep, it returns ServerName<'static> now.
:thumbs_up: rvolosatovs submitted PR review.
rvolosatovs added PR #13686 fix tls server name extraction for ipv6 authorities in wasi-http to the merge queue.
:check: rvolosatovs merged PR #13686.
rvolosatovs removed PR #13686 fix tls server name extraction for ipv6 authorities in wasi-http from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC