summaryrefslogtreecommitdiff
path: root/test/open-uri/test_open-uri.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-20 01:56:21 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-20 01:56:21 +0000
commit9416becda4592f7884460a054fe12b7761f6f055 (patch)
treeb8bf90896acfb3610e1f0665e50cf31fbbd3f209 /test/open-uri/test_open-uri.rb
parentf35b1d0633a6423f1281fb3c2b29aa522090976f (diff)
* lib/net/http.rb: Net::HTTP now automatically detects and uses
proxies from the environment. A proxy may also be specified as before. Net::HTTP::Proxy still creates anonymous classes, but these classes are only used to store configuration information. When an HTTP instance is created the configuration is now copied. Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP [Feature #6546] * lib/open-uri.rb: Moved URI::Generic#find_proxy to uri/generic. * lib/uri/generic.rb: Imported find_proxy from open-uri. * test/open-uri/test_open-uri.rb: Moved proxy-discovery tests to URI. * test/uri/test_generic.rb: Imported proxy-discovery tests from open-uri. * test/net/http/test_http.rb: Added tests for proxy behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/open-uri/test_open-uri.rb')
-rw-r--r--test/open-uri/test_open-uri.rb35
1 files changed, 0 insertions, 35 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 8b3f817..5c9bddf 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -504,41 +504,6 @@ class TestOpenURI < Test::Unit::TestCase
# 192.0.2.0/24 is TEST-NET. [RFC3330]
- def test_find_proxy
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("ftp://192.0.2.1/").find_proxy)
- with_env('http_proxy'=>'http://127.0.0.1:8080') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("ftp://192.0.2.1/").find_proxy)
- }
- with_env('ftp_proxy'=>'http://127.0.0.1:8080') {
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- assert_equal(URI('http://127.0.0.1:8080'), URI("ftp://192.0.2.1/").find_proxy)
- }
- with_env('REQUEST_METHOD'=>'GET') {
- assert_nil(URI("http://192.0.2.1/").find_proxy)
- }
- with_env('CGI_HTTP_PROXY'=>'http://127.0.0.1:8080', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'no_proxy'=>'192.0.2.2') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- assert_nil(URI("http://192.0.2.2/").find_proxy)
- }
- end
-
- def test_find_proxy_case_sensitive_env
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- with_env('HTTP_PROXY'=>'http://127.0.0.1:8081', 'REQUEST_METHOD'=>'GET') {
- assert_nil(nil, URI("http://192.0.2.1/").find_proxy)
- }
- with_env('http_proxy'=>'http://127.0.0.1:8080', 'HTTP_PROXY'=>'http://127.0.0.1:8081', 'REQUEST_METHOD'=>'GET') {
- assert_equal(URI('http://127.0.0.1:8080'), URI("http://192.0.2.1/").find_proxy)
- }
- end unless RUBY_PLATFORM =~ /mswin|mingw/
-
def test_ftp_invalid_request
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/").read }
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/a%0Db").read }