fix r53013; the environment defines "example" as local hostname

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2015-12-09 21:54:21 +00:00
parent 328205c56e
commit f8a720477c

View File

@ -22,7 +22,7 @@ class TestNetHTTP < Test::Unit::TestCase
assert_equal 'user', proxy_class.proxy_user assert_equal 'user', proxy_class.proxy_user
assert_equal 'pass', proxy_class.proxy_pass assert_equal 'pass', proxy_class.proxy_pass
http = proxy_class.new 'example' http = proxy_class.new 'hostname.example'
refute http.proxy_from_env? refute http.proxy_from_env?
@ -52,14 +52,14 @@ class TestNetHTTP < Test::Unit::TestCase
refute_equal 8000, proxy_class.proxy_port refute_equal 8000, proxy_class.proxy_port
http = proxy_class.new 'example' http = proxy_class.new 'hostname.example'
assert http.proxy_from_env? assert http.proxy_from_env?
end end
end end
def test_edit_path def test_edit_path
http = Net::HTTP.new 'example', nil, nil http = Net::HTTP.new 'hostname.example', nil, nil
edited = http.send :edit_path, '/path' edited = http.send :edit_path, '/path'
@ -73,11 +73,11 @@ class TestNetHTTP < Test::Unit::TestCase
end end
def test_edit_path_proxy def test_edit_path_proxy
http = Net::HTTP.new 'example', nil, 'proxy.example' http = Net::HTTP.new 'hostname.example', nil, 'proxy.example'
edited = http.send :edit_path, '/path' edited = http.send :edit_path, '/path'
assert_equal 'http://example/path', edited assert_equal 'http://hostname.example/path', edited
http.use_ssl = true http.use_ssl = true
@ -88,10 +88,10 @@ class TestNetHTTP < Test::Unit::TestCase
def test_proxy_address def test_proxy_address
clean_http_proxy_env do clean_http_proxy_env do
http = Net::HTTP.new 'example', nil, 'proxy.example' http = Net::HTTP.new 'hostname.example', nil, 'proxy.example'
assert_equal 'proxy.example', http.proxy_address assert_equal 'proxy.example', http.proxy_address
http = Net::HTTP.new 'example', nil http = Net::HTTP.new 'hostname.example', nil
assert_equal nil, http.proxy_address assert_equal nil, http.proxy_address
end end
end end
@ -101,7 +101,7 @@ class TestNetHTTP < Test::Unit::TestCase
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
assert_equal false, Net::HTTP.proxy_class? assert_equal false, Net::HTTP.proxy_class?
http = Net::HTTP.new 'example' http = Net::HTTP.new 'hostname.example'
assert_equal true, http.proxy_from_env? assert_equal true, http.proxy_from_env?
end end
@ -111,7 +111,7 @@ class TestNetHTTP < Test::Unit::TestCase
clean_http_proxy_env do clean_http_proxy_env do
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
http = Net::HTTP.new 'example' http = Net::HTTP.new 'hostname.example'
assert_equal 'proxy.example', http.proxy_address assert_equal 'proxy.example', http.proxy_address
end end
@ -119,7 +119,7 @@ class TestNetHTTP < Test::Unit::TestCase
def test_proxy_eh_no_proxy def test_proxy_eh_no_proxy
clean_http_proxy_env do clean_http_proxy_env do
assert_equal false, Net::HTTP.new('example', nil, nil).proxy? assert_equal false, Net::HTTP.new('hostname.example', nil, nil).proxy?
end end
end end
@ -127,7 +127,7 @@ class TestNetHTTP < Test::Unit::TestCase
clean_http_proxy_env do clean_http_proxy_env do
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
http = Net::HTTP.new 'example' http = Net::HTTP.new 'hostname.example'
assert_equal true, http.proxy? assert_equal true, http.proxy?
end end
@ -135,16 +135,16 @@ class TestNetHTTP < Test::Unit::TestCase
def test_proxy_eh_ENV_none_set def test_proxy_eh_ENV_none_set
clean_http_proxy_env do clean_http_proxy_env do
assert_equal false, Net::HTTP.new('example').proxy? assert_equal false, Net::HTTP.new('hostname.example').proxy?
end end
end end
def test_proxy_eh_ENV_no_proxy def test_proxy_eh_ENV_no_proxy
clean_http_proxy_env do clean_http_proxy_env do
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
ENV['no_proxy'] = 'example' ENV['no_proxy'] = 'hostname.example'
assert_equal false, Net::HTTP.new('example').proxy? assert_equal false, Net::HTTP.new('hostname.example').proxy?
end end
end end
@ -164,7 +164,7 @@ class TestNetHTTP < Test::Unit::TestCase
clean_http_proxy_env do clean_http_proxy_env do
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
http = Net::HTTP.new 'example' http = Net::HTTP.new 'hostname.example'
assert_equal 8000, http.proxy_port assert_equal 8000, http.proxy_port
end end
@ -174,7 +174,7 @@ class TestNetHTTP < Test::Unit::TestCase
clean_http_proxy_env do clean_http_proxy_env do
ENV['http_proxy'] = 'http://proxy.example:8000' ENV['http_proxy'] = 'http://proxy.example:8000'
http = Net::HTTP.newobj 'example' http = Net::HTTP.newobj 'hostname.example'
assert_equal false, http.proxy? assert_equal false, http.proxy?
end end
@ -554,7 +554,7 @@ module TestNetHTTP_version_1_2_methods
end end
def _test_request__path(http) def _test_request__path(http)
uri = URI 'https://example/' uri = URI 'https://hostname.example/'
req = Net::HTTP::Get.new('/') req = Net::HTTP::Get.new('/')
res = http.request(req) res = http.request(req)
@ -570,7 +570,7 @@ module TestNetHTTP_version_1_2_methods
end end
def _test_request__uri(http) def _test_request__uri(http)
uri = URI 'https://example/' uri = URI 'https://hostname.example/'
req = Net::HTTP::Get.new(uri) req = Net::HTTP::Get.new(uri)
res = http.request(req) res = http.request(req)
@ -589,13 +589,13 @@ module TestNetHTTP_version_1_2_methods
uri = URI 'http://other.example/' uri = URI 'http://other.example/'
req = Net::HTTP::Get.new(uri) req = Net::HTTP::Get.new(uri)
req['host'] = 'example' req['host'] = 'hostname.example'
res = http.request(req) res = http.request(req)
assert_kind_of URI::Generic, req.uri assert_kind_of URI::Generic, req.uri
assert_equal URI("http://example:#{http.port}"), res.uri assert_equal URI("http://hostname.example:#{http.port}"), res.uri
end end
def test_send_request def test_send_request