mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
328205c56e
commit
f8a720477c
1 changed files with 20 additions and 20 deletions
|
@ -22,7 +22,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
assert_equal 'user', proxy_class.proxy_user
|
||||
assert_equal 'pass', proxy_class.proxy_pass
|
||||
|
||||
http = proxy_class.new 'example'
|
||||
http = proxy_class.new 'hostname.example'
|
||||
|
||||
refute http.proxy_from_env?
|
||||
|
||||
|
@ -52,14 +52,14 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
|
||||
refute_equal 8000, proxy_class.proxy_port
|
||||
|
||||
http = proxy_class.new 'example'
|
||||
http = proxy_class.new 'hostname.example'
|
||||
|
||||
assert http.proxy_from_env?
|
||||
end
|
||||
end
|
||||
|
||||
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'
|
||||
|
||||
|
@ -73,11 +73,11 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
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'
|
||||
|
||||
assert_equal 'http://example/path', edited
|
||||
assert_equal 'http://hostname.example/path', edited
|
||||
|
||||
http.use_ssl = true
|
||||
|
||||
|
@ -88,10 +88,10 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
|
||||
def test_proxy_address
|
||||
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
|
||||
|
||||
http = Net::HTTP.new 'example', nil
|
||||
http = Net::HTTP.new 'hostname.example', nil
|
||||
assert_equal nil, http.proxy_address
|
||||
end
|
||||
end
|
||||
|
@ -101,7 +101,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
ENV['http_proxy'] = 'http://proxy.example:8000'
|
||||
|
||||
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?
|
||||
end
|
||||
|
@ -111,7 +111,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
clean_http_proxy_env do
|
||||
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
|
||||
end
|
||||
|
@ -119,7 +119,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
|
||||
def test_proxy_eh_no_proxy
|
||||
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
|
||||
|
||||
|
@ -127,7 +127,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
clean_http_proxy_env do
|
||||
ENV['http_proxy'] = 'http://proxy.example:8000'
|
||||
|
||||
http = Net::HTTP.new 'example'
|
||||
http = Net::HTTP.new 'hostname.example'
|
||||
|
||||
assert_equal true, http.proxy?
|
||||
end
|
||||
|
@ -135,16 +135,16 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
|
||||
def test_proxy_eh_ENV_none_set
|
||||
clean_http_proxy_env do
|
||||
assert_equal false, Net::HTTP.new('example').proxy?
|
||||
assert_equal false, Net::HTTP.new('hostname.example').proxy?
|
||||
end
|
||||
end
|
||||
|
||||
def test_proxy_eh_ENV_no_proxy
|
||||
clean_http_proxy_env do
|
||||
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
|
||||
|
||||
|
@ -164,7 +164,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
clean_http_proxy_env do
|
||||
ENV['http_proxy'] = 'http://proxy.example:8000'
|
||||
|
||||
http = Net::HTTP.new 'example'
|
||||
http = Net::HTTP.new 'hostname.example'
|
||||
|
||||
assert_equal 8000, http.proxy_port
|
||||
end
|
||||
|
@ -174,7 +174,7 @@ class TestNetHTTP < Test::Unit::TestCase
|
|||
clean_http_proxy_env do
|
||||
ENV['http_proxy'] = 'http://proxy.example:8000'
|
||||
|
||||
http = Net::HTTP.newobj 'example'
|
||||
http = Net::HTTP.newobj 'hostname.example'
|
||||
|
||||
assert_equal false, http.proxy?
|
||||
end
|
||||
|
@ -554,7 +554,7 @@ module TestNetHTTP_version_1_2_methods
|
|||
end
|
||||
|
||||
def _test_request__path(http)
|
||||
uri = URI 'https://example/'
|
||||
uri = URI 'https://hostname.example/'
|
||||
req = Net::HTTP::Get.new('/')
|
||||
|
||||
res = http.request(req)
|
||||
|
@ -570,7 +570,7 @@ module TestNetHTTP_version_1_2_methods
|
|||
end
|
||||
|
||||
def _test_request__uri(http)
|
||||
uri = URI 'https://example/'
|
||||
uri = URI 'https://hostname.example/'
|
||||
req = Net::HTTP::Get.new(uri)
|
||||
|
||||
res = http.request(req)
|
||||
|
@ -589,13 +589,13 @@ module TestNetHTTP_version_1_2_methods
|
|||
uri = URI 'http://other.example/'
|
||||
|
||||
req = Net::HTTP::Get.new(uri)
|
||||
req['host'] = 'example'
|
||||
req['host'] = 'hostname.example'
|
||||
|
||||
res = http.request(req)
|
||||
|
||||
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
|
||||
|
||||
def test_send_request
|
||||
|
|
Loading…
Add table
Reference in a new issue