summaryrefslogtreecommitdiff
path: root/lib/open-uri.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-25 09:56:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-25 09:56:49 +0000
commit922dc8265f47af47327cf01bb5365f2ea8454d16 (patch)
tree724bde0bb8d3eac4c60ab8f6b289711d686e8fd4 /lib/open-uri.rb
parent0452420e4c33b32050aa46bc08d39b7f35dc3864 (diff)
* lib/open-uri.rb (URI::Generic#find_proxy): ENV case sensitivity test
refined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/open-uri.rb')
-rw-r--r--lib/open-uri.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 168bc0a76d..917f385cec 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -458,9 +458,19 @@ module URI
# HTTP_PROXY conflicts with *_proxy for proxy settings and
# HTTP_* for header informatin in CGI.
# So it should be careful to use it.
- case_sentsitive = /djgpp|bccwin32|mingw|mswin32|mswince|emx/ !~ RUBY_PLATFORM
- if case_sentsitive
- # http_proxy is safe to use.
+ pairs = ENV.reject {|k, v| /\Ahttp_proxy\z/i !~ k }
+ case pairs.length
+ when 0 # no proxy setting anyway.
+ proxy_uri = nil
+ when 1
+ k, v = pairs[0]
+ if k == 'http_proxy' && ENV[k.upcase] == nil
+ # http_proxy is safe to use becase ENV is case sensitive.
+ proxy_uri = ENV[name]
+ else
+ proxy_uri = nil
+ end
+ else # http_proxy is safe to use becase ENV is case sensitive.
proxy_uri = ENV[name]
end
if !proxy_uri