summaryrefslogtreecommitdiff
path: root/test/open-uri/test_ssl.rb
diff options
context:
space:
mode:
authorTanaka Akira <akr@fsij.org>2019-07-14 17:18:17 +0900
committerTanaka Akira <akr@fsij.org>2019-07-14 17:18:17 +0900
commit05aac90a1bcfeb180f5e78ea8b00a4d1b04d5eed (patch)
tree6d281c9ddb92f724fef239c57f38543604b875f9 /test/open-uri/test_ssl.rb
parent9987296b8b5b7c02fca92761e498764dfeb584cf (diff)
Warn open-uri's "open" method at Kernel.
Use URI.open instead. Thanks for the patch by jeremyevans0 (Jeremy Evans) [Misc #15893].
Diffstat (limited to 'test/open-uri/test_ssl.rb')
-rw-r--r--test/open-uri/test_ssl.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb
index 337139604f..4f645d83b9 100644
--- a/test/open-uri/test_ssl.rb
+++ b/test/open-uri/test_ssl.rb
@@ -67,7 +67,7 @@ class TestOpenURISSL
def setup_validation(srv, dr)
cacert_filename = "#{dr}/cacert.pem"
- open(cacert_filename, "w") {|f| f << CA_CERT }
+ URI.open(cacert_filename, "w") {|f| f << CA_CERT }
srv.mount_proc("/data", lambda { |req, res| res.body = "ddd" } )
cacert_filename
end
@@ -75,7 +75,7 @@ class TestOpenURISSL
def test_validation_success
with_https {|srv, dr, url|
cacert_filename = setup_validation(srv, dr)
- open("#{url}/data", :ssl_ca_cert => cacert_filename) {|f|
+ URI.open("#{url}/data", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
assert_equal("ddd", f.read)
}
@@ -85,7 +85,7 @@ class TestOpenURISSL
def test_validation_noverify
with_https {|srv, dr, url|
setup_validation(srv, dr)
- open("#{url}/data", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) {|f|
+ URI.open("#{url}/data", :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) {|f|
assert_equal("200", f.status[0])
assert_equal("ddd", f.read)
}
@@ -103,7 +103,7 @@ class TestOpenURISSL
end
with_https(log_tester) {|srv, dr, url, server_thread, server_log|
setup_validation(srv, dr)
- assert_raise(OpenSSL::SSL::SSLError) { open("#{url}/data") {} }
+ assert_raise(OpenSSL::SSL::SSLError) { URI.open("#{url}/data") {} }
}
end
@@ -149,7 +149,7 @@ class TestOpenURISSL
}
with_https_proxy(proxy_log_tester) {|srv, dr, url_, cacert_filename, cacert_directory, proxy_host, proxy_port|
url = url_
- open("#{url}/proxy", :proxy=>"http://#{proxy_host}:#{proxy_port}/", :ssl_ca_cert => cacert_filename) {|f|
+ URI.open("#{url}/proxy", :proxy=>"http://#{proxy_host}:#{proxy_port}/", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
assert_equal("proxy", f.read)
}
@@ -165,7 +165,7 @@ class TestOpenURISSL
}
with_https_proxy(proxy_log_tester) {|srv, dr, url_, cacert_filename, cacert_directory, proxy_host, proxy_port|
url = url_
- open("#{url}/proxy", :proxy=>"http://#{proxy_host}:#{proxy_port}/", :ssl_ca_cert => cacert_directory) {|f|
+ URI.open("#{url}/proxy", :proxy=>"http://#{proxy_host}:#{proxy_port}/", :ssl_ca_cert => cacert_directory) {|f|
assert_equal("200", f.status[0])
assert_equal("proxy", f.read)
}