From 0e8dc9112050bd69141e492d57725245cd2122bd Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 29 Jul 2020 12:34:07 -0700 Subject: [PATCH] Switch invalid server name format invalid_servername is not a valid name in an SSL request due to the use of the underscore, and LibreSSL 3.2.0 will raise an exception for this. These tests are not testing the allowed characters in the server name, but how net/http handles cases where the server name provided does not match the IP address you are trying to connect to, so I think it's better to just modify the tests to use a correct format. While here, fix a typo in a test name, and use better code in the ensure block so the same test doesn't issue both a failure and an error. --- test/net/http/test_https.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb index 660104d0..7660ef68 100644 --- a/test/net/http/test_https.rb +++ b/test/net/http/test_https.rb @@ -108,7 +108,7 @@ def test_get_SNI_proxy def test_get_SNI_failure TestNetHTTPUtils.clean_http_proxy_env do - http = Net::HTTP.new("invalid_servername", config("port")) + http = Net::HTTP.new("invalidservername", config("port")) http.ipaddr = config('host') http.use_ssl = true http.cert_store = TEST_STORE @@ -204,22 +204,22 @@ def test_verify_none skip $! end - def test_skip_hostname_verfiction + def test_skip_hostname_verification TestNetHTTPUtils.clean_http_proxy_env do - http = Net::HTTP.new('invalid_servername', config('port')) + http = Net::HTTP.new('invalidservername', config('port')) http.ipaddr = config('host') http.use_ssl = true http.cert_store = TEST_STORE http.verify_hostname = false assert_nothing_raised { http.start } ensure - http&.finish + http.finish if http&.started? end end def test_fail_if_verify_hostname_is_true TestNetHTTPUtils.clean_http_proxy_env do - http = Net::HTTP.new('invalid_servername', config('port')) + http = Net::HTTP.new('invalidservername', config('port')) http.ipaddr = config('host') http.use_ssl = true http.cert_store = TEST_STORE