From 1cb4eae934bd5f2ff7eb9006702b76d6fb60c82d Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 25 Nov 2003 09:56:49 +0000 Subject: * lib/open-uri.rb (URI::Generic#find_proxy): ENV case sensitivity test refined. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/open-uri.rb | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4fcaa7ab..f39b6c95e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Nov 25 18:56:06 2003 Tanaka Akira + + * lib/open-uri.rb (URI::Generic#find_proxy): ENV case sensitivity test + refined. + Tue Nov 25 18:13:30 2003 Minero Aoki * test/fileutils/test_fileutils.rb: chdir Dir.tmpdir before each diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 168bc0a76..917f385ce 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 -- cgit