Skip to content

Commit 6ab399d

Browse files
committed
Handle invalid use of IP addresses in SNI
Server Name Indication does not allow IP addresses (RFC 6066, section 3: `Literal IPv4 and IPv6 addresses are not permitted in "HostName".`). Recent versions of LibreSSL enforce this restriction, which raises when setting the hostname to an IP address (s.hostname=), before attempting to setup the SSL connection. Since the certificate used in the test is already for localhost, we cannot connect to localhost. However, as all the test does is check for a specific exception, just modify the regexp used so it handles both cases.
1 parent 0e29d6e commit 6ab399d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/net/http/test_https.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def test_identity_verify_failure
255255
ex = assert_raise(OpenSSL::SSL::SSLError){
256256
http.request_get("/") {|res| }
257257
}
258-
re_msg = /certificate verify failed|hostname \"#{HOST_IP}\" does not match/
258+
re_msg = /certificate verify failed|hostname \"#{HOST_IP}\" does not match|ssl3 ext invalid servername/
259259
assert_match(re_msg, ex.message)
260260
end
261261

0 commit comments

Comments
 (0)