Do not set SNI hostname if connecting to IP address #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC 6066, section 3, explicitly disallows the use of an IP address
as an SNI server name. So check if the connection is being made
to an IP address using the resolv regexps, and do not set an SNI
hostname in that case.
Note that this results in a warning in the tests, but that is due
to an issue in the openssl extension. A pull request has been
submitted to the openssl extension to remove that warning.
Revert the previous change that modified the regexp used for
checking the error message.
This not only fixes net/http tests, it also fixes tests for
webrick and open-uri when used with recent LibreSSL , which both make SSL connections to 127.0.0.1
in their tests.