diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-23 16:19:23 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-23 16:19:23 +0000 |
commit | c7ec1b1f599de0297bbf2cba92a923a337df73a6 (patch) | |
tree | 6b5853c6131e7000230a7cc915f3b7cacb6cb3f6 /test | |
parent | ece9698d73566c9f632fcd0bb4383799f9d9bda3 (diff) | |
download | ruby-c7ec1b1f599de0297bbf2cba92a923a337df73a6.tar.gz |
Allow Net::HTTP to fetch user/pass from http_proxy
Note that this feature is enabled only on environment variables are
multi-user safe. In this time the list includes Linux, FreeBSD, or
Darwin. [Bug #12921]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/net/http/test_http.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index f2c03f2915..7db5909f96 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -134,6 +134,23 @@ class TestNetHTTP < Test::Unit::TestCase end end + def test_proxy_eh_ENV_with_user + clean_http_proxy_env do + ENV['http_proxy'] = 'http://foo:bar@proxy.example:8000' + + http = Net::HTTP.new 'hostname.example' + + assert_equal true, http.proxy? + if Net::HTTP::ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE + assert_equal 'foo', http.proxy_user + assert_equal 'bar', http.proxy_pass + else + assert_nil http.proxy_user + assert_nil http.proxy_pass + end + end + end + def test_proxy_eh_ENV_none_set clean_http_proxy_env do assert_equal false, Net::HTTP.new('hostname.example').proxy? |