Skip to content

WebSocket: bracket an IPv6 address in the Host header - #11

Open
dominicletz wants to merge 1 commit into
cursor/udp-ipv6-and-v6only-84b4from
cursor/websocket-host-ipv6-84b4
Open

dominicletz wants to merge 1 commit into
cursor/udp-ipv6-and-v6only-84b4from
cursor/websocket-host-ipv6-84b4

Conversation

@dominicletz

@dominicletz dominicletz commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Rebase of #10 onto the rebased UDP branch (#13), which sits on the rebased TCP/SSL branch (#12). The address-parser commit #10 was stacked on already landed as #7. lib/socket/web.ex merged cleanly with the frame fixes from #6.

The handshake sent Host: ::1:443. RFC 3986 §3.2.2 requires the brackets, because that is how the peer tells the address from the port. Socket.Address.to_uri_host/1 adds them and prints the canonical form (RFC 5952). IPv4 addresses and host names come back unchanged. Socket.Web.connect/3 is the caller.

The new handshake test connects to "::1". Socket.Web.connect!/3 dials through Socket.TCP.connect!/3, so this depends on #12: without it the connect fails :nxdomain and the header is never sent. It does not use the UDP changes in #13; those sit underneath only so test/ipv6_test.exs does not conflict between the two branches.

Merge #12, then #13, then this.

mix test on this branch is 24 tests, 0 failures (Elixir 1.14.0 / OTP 25). mix format --check-formatted passes, and mix compile --warnings-as-errors is clean.

Open in Web Open in Cursor 

Note

Low Risk
Localized change to Host header formatting in WebSocket connect; improves RFC compliance with no auth or data-path impact.

Reviewed by Cursor Bugbot for commit c0cfbe7. Configure here.

The handshake now sends `Host: [::1]:443`. RFC 3986 §3.2.2 requires the
brackets: they tell the peer where the address ends and the port begins.

Socket.Address.to_uri_host/1 adds them and prints the canonical form
(RFC 5952). IPv4 addresses and host names come back unchanged.
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