Skip to content

Commit 0e8dc91

Browse files
committed
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.
1 parent 6eda06d commit 0e8dc91

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/net/http/test_https.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_get_SNI_proxy
108108

109109
def test_get_SNI_failure
110110
TestNetHTTPUtils.clean_http_proxy_env do
111-
http = Net::HTTP.new("invalid_servername", config("port"))
111+
http = Net::HTTP.new("invalidservername", config("port"))
112112
http.ipaddr = config('host')
113113
http.use_ssl = true
114114
http.cert_store = TEST_STORE
@@ -204,22 +204,22 @@ def test_verify_none
204204
skip $!
205205
end
206206

207-
def test_skip_hostname_verfiction
207+
def test_skip_hostname_verification
208208
TestNetHTTPUtils.clean_http_proxy_env do
209-
http = Net::HTTP.new('invalid_servername', config('port'))
209+
http = Net::HTTP.new('invalidservername', config('port'))
210210
http.ipaddr = config('host')
211211
http.use_ssl = true
212212
http.cert_store = TEST_STORE
213213
http.verify_hostname = false
214214
assert_nothing_raised { http.start }
215215
ensure
216-
http&.finish
216+
http.finish if http&.started?
217217
end
218218
end
219219

220220
def test_fail_if_verify_hostname_is_true
221221
TestNetHTTPUtils.clean_http_proxy_env do
222-
http = Net::HTTP.new('invalid_servername', config('port'))
222+
http = Net::HTTP.new('invalidservername', config('port'))
223223
http.ipaddr = config('host')
224224
http.use_ssl = true
225225
http.cert_store = TEST_STORE

0 commit comments

Comments
 (0)