aboutsummaryrefslogtreecommitdiffstats
path: root/test/uri
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-28 10:51:31 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-28 10:51:31 +0000
commitec7c76c446fcb7fafae2fa2f7eda78c2387fac23 (patch)
tree83acc0f1f980386192d9566e012087a21ca443d5 /test/uri
parente4136c7bee2091c52915ef94432e673174306bb8 (diff)
downloadruby-ec7c76c446fcb7fafae2fa2f7eda78c2387fac23.tar.gz
URI::Generic: Separate no_proxy handling
To share with Net::HTTP. see #11195 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/uri')
-rw-r--r--test/uri/test_generic.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 1a470a6d18..aa782db27e 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -906,6 +906,23 @@ class URI::TestGeneric < Test::Unit::TestCase
}
end
+ def test_use_proxy_p
+ [
+ ['example.com', nil, 80, '', true],
+ ['example.com', nil, 80, 'example.com:80', false],
+ ['example.com', nil, 80, 'example.org,example.com:80,example.net', false],
+ ['foo.example.com', nil, 80, 'example.com', false],
+ ['foo.example.com', nil, 80, 'example.com:80', false],
+ ['foo.example.com', nil, 80, 'example.com:443', true],
+ ['127.0.0.1', '127.0.0.1', 80, '10.224.0.0/22', true],
+ ['10.224.1.1', '10.224.1.1', 80, '10.224.1.1', false],
+ ['10.224.1.1', '10.224.1.1', 80, '10.224.0.0/22', false],
+ ].each do |hostname, addr, port, no_proxy, expected|
+ assert_equal expected, URI::Generic.use_proxy?(hostname, addr, port, no_proxy),
+ "use_proxy?('#{hostname}', '#{addr}', #{port}, '#{no_proxy}')"
+ end
+ end
+
class CaseInsensitiveEnv
def initialize(h={})
@h = {}