summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-07-05 17:39:06 +0900
committergit <[email protected]>2024-07-08 04:53:13 +0000
commitbf898057b40d21994cbf86dbd8b3cad412ef8847 (patch)
tree76123bfdc7bbcf06c7d77df948945d62a7c3b7fc
parent71490d23147c0a9e2850634037305cdca0d39292 (diff)
[ruby/open-uri] Test with Windows
https://github.com/ruby/open-uri/commit/2606892a43
-rw-r--r--test/open-uri/test_ssl.rb4
-rw-r--r--test/open-uri/utils.rb15
2 files changed, 13 insertions, 6 deletions
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb
index 31b93e0b13..067d115ee1 100644
--- a/test/open-uri/test_ssl.rb
+++ b/test/open-uri/test_ssl.rb
@@ -76,6 +76,8 @@ class TestOpenURISSL < Test::Unit::TestCase
end
def test_proxy_cacert_file
+ pend if RUBY_PLATFORM =~ /mswin|mingw/
+
url = nil
proxy_log_tester = lambda {|proxy_log, proxy_access_log|
assert_equal(1, proxy_access_log.length)
@@ -92,6 +94,8 @@ class TestOpenURISSL < Test::Unit::TestCase
end
def test_proxy_cacert_dir
+ pend if RUBY_PLATFORM =~ /mswin|mingw/
+
url = nil
proxy_log_tester = lambda {|proxy_log, proxy_access_log|
assert_equal(1, proxy_access_log.length)
diff --git a/test/open-uri/utils.rb b/test/open-uri/utils.rb
index ee0c0e4b82..b529ba8fe8 100644
--- a/test/open-uri/utils.rb
+++ b/test/open-uri/utils.rb
@@ -313,7 +313,8 @@ module TestOpenURIUtils
def with_http(log_tester=lambda {|log| assert_equal([], log) })
log = []
- srv = SimpleHTTPServer.new('localhost', 0, log)
+ host = "127.0.0.1"
+ srv = SimpleHTTPServer.new(host, 0, log)
server_thread = srv.start
server_thread2 = Thread.new {
@@ -327,7 +328,7 @@ module TestOpenURIUtils
client_thread = Thread.new {
begin
- yield srv, "http://localhost:#{port}", server_thread, log
+ yield srv, "http://#{host}:#{port}", server_thread, log
ensure
srv.shutdown
end
@@ -346,9 +347,10 @@ module TestOpenURIUtils
Dir.mkdir cacert_directory
hashed_name = "%08x.0" % OpenSSL::X509::Certificate.new(CA_CERT).subject.hash
open("#{cacert_directory}/#{hashed_name}", "w") {|f| f << CA_CERT }
- proxy = SimpleHTTPProxyServer.new('127.0.0.1', 0, proxy_log, proxy_access_log)
+ proxy_host = '127.0.0.1'
+ proxy = SimpleHTTPProxyServer.new(proxy_host, 0, proxy_log, proxy_access_log)
proxy.start
- _, proxy_port, _, proxy_host = proxy.instance_variable_get(:@server).addr
+ proxy_port = proxy.instance_variable_get(:@server).addr[1]
proxy_thread = proxy.start
threads << Thread.new {
proxy_thread.join
@@ -371,8 +373,9 @@ module TestOpenURIUtils
cert = OpenSSL::X509::Certificate.new(SERVER_CERT)
key = OpenSSL::PKey::RSA.new(SERVER_KEY)
dh = OpenSSL::PKey::DH.new(DHPARAMS)
- srv = SimpleHTTPSServer.new(cert, key, dh, '127.0.0.1', 0, log)
- _, port, _, host = srv.instance_variable_get(:@server).addr
+ host = '127.0.0.1'
+ srv = SimpleHTTPSServer.new(cert, key, dh, host, 0, log)
+ port = srv.instance_variable_get(:@server).addr[1]
threads = []
server_thread = srv.start
threads << Thread.new {