-
Notifications
You must be signed in to change notification settings - Fork 145
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
Can't resolve IP address with square brakets #181
Comments
Are you setting an actual DNS server name separately? Because rustls doesn't currently support IP addresses in certificates it won't otherwise be able to establish a session anyway. |
I am not using a DNS, but I am using custom certs and all custom rustls cert verifiers. I have checked locally and this works. |
This is the only change (in external codebase) that is needed to make requests to IP with rustls work #182 |
Shouldn't rustls/rustls#1032 mitigate this? I see this current With that patch on rustls and a custom cert verifiers (thus, dangerous config), it should be feasible if I am not wrong. |
Hi BiagioFesta! |
Guys, thank you for pulling in the PR. I have to make a call today to decide if I am pulling in this fix from crates.io or if I need to embed a copy of hyper-rustls in my software release. |
I've submitted #183. |
Problem
Sending to destination like
https://[::1]/
fails with errorinvalid dnsname
.Error is thrown here https://github.com/rustls/hyper-rustls/blob/main/src/connector.rs#L95
Analysis
hyper-rustls resolves the Hostname as
hyper::Uri::host
This makes hostname = "[::1]" which is HTTP-specific form of writing IPv6 address.
Root-Cause
hyper-rustls is resolving the host name using
rustls::ServerName::try_from(hostname)
which does not expect square brackets in IP because internally it usesProposed solution
Since square brakets are coming from hyper and not part standard IP notation I propose that we remove any square brakets inside of the connector before calling the
rustls::ServerName::try_from(hostname)
Will post a PR in bit
The text was updated successfully, but these errors were encountered: