-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix client SNI handling #3613
fix client SNI handling #3613
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the host doesn't contain any port? net.SplitHostPort
will error in that case.
Codecov ReportBase: 85.48% // Head: 85.50% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #3613 +/- ##
==========================================
+ Coverage 85.48% 85.50% +0.02%
==========================================
Files 141 141
Lines 10296 10293 -3
==========================================
- Hits 8801 8800 -1
+ Misses 1109 1108 -1
+ Partials 386 385 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
My change is to handle this situation exactly. An IPv6 address (without a port) contains colons but is not in the |
Got it, that makes sense. I missed that the |
The current code assumes that a hostname containing a colon is in the
host:port
format, but it could actually be an IPv6 address. Calling SplitHostPort in this case returns an error, and right now the Client will fail to initialize.It is possible and not extremely rare to have a TLS cert with IPv6 SAN(s). Real-life examples include Cloudflare's https://[2606:4700:4700::1111]/ and some users of my project using self-signed CAs to issue certs for their IPv6 addresses.