Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support IPv6 URIs with rustls #280

Merged
merged 1 commit into from
May 7, 2023

Conversation

mjquigley
Copy link
Contributor

When trying to connect to an IPv6 address with the rustls feature enabled, the connection fails because rustls parses the domain as an std::net::IPAddr which expects the IP to not have the square brackets around it e.g. 2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF instead of [2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF]. But when providing/parsing an http::URI the square brackets are required.

If we strip the square brackets from the host before passing it to rustls the connection works.

Repro snippet:

tokio_tungstenite::connect_async("wss://[2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF]:443").await.expect("to connect");

@agalakhov
Copy link
Member

This looks good, but please rename the commit so that one can understand what's changed.

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.

None yet

3 participants