зеркало из https://github.com/github/ruby.git
* lib/open-uri.rb (URI::Generic#find_proxy): use http_proxy under CGI
if the environment variable is case sensitive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f1d89b24da
Коммит
a3388b68b7
|
@ -1,3 +1,8 @@
|
|||
Tue Nov 25 17:52:11 2003 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* lib/open-uri.rb (URI::Generic#find_proxy): use http_proxy under CGI
|
||||
if the environment variable is case sensitive.
|
||||
|
||||
Tue Nov 25 16:41:33 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* test/wsdl/multiplefault.wsdl, test/wsdl/test_multiplefault.rb:
|
||||
|
|
|
@ -443,16 +443,35 @@ module URI
|
|||
# ftp_proxy, no_proxy, etc.
|
||||
# If there is no proper proxy, nil is returned.
|
||||
#
|
||||
# The enveironment variable CGI_http_proxy and CGI_HTTP_PROXY is used
|
||||
# instead of http_proxy and HTTP_PROXY in the CGI environment because
|
||||
# HTTP_PROXY can be set by Proxy: header sent by a CGI client.
|
||||
# Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.)
|
||||
# are examined too.
|
||||
#
|
||||
# But http_proxy and HTTP_PROXY is treated specially under CGI environment.
|
||||
# It's because HTTP_PROXY may be set by Proxy: header.
|
||||
# So HTTP_PROXY is not used.
|
||||
# http_proxy is not used too if the variable is case insentitive.
|
||||
# CGI_HTTP_PROXY can be used instead.
|
||||
def find_proxy
|
||||
name = self.scheme.downcase + '_proxy'
|
||||
if ENV.include? 'REQUEST_METHOD' # in CGI?
|
||||
# Use CGI_HTTP_PROXY. cf. libwww-perl.
|
||||
name = "CGI_#{name}" if /\Ahttp_/i =~ name
|
||||
proxy_uri = nil
|
||||
if name == 'http_proxy' && ENV.include?('REQUEST_METHOD') # CGI?
|
||||
# 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.
|
||||
proxy_uri = ENV[name]
|
||||
end
|
||||
if !proxy_uri
|
||||
# Use CGI_HTTP_PROXY. cf. libwww-perl.
|
||||
proxy_uri = ENV["CGI_#{name.upcase}"]
|
||||
end
|
||||
else
|
||||
proxy_uri = ENV[name] || ENV[name.upcase]
|
||||
end
|
||||
if proxy_uri = ENV[name] || ENV[name.upcase]
|
||||
|
||||
if proxy_uri
|
||||
proxy_uri = URI.parse(proxy_uri)
|
||||
name = 'no_proxy'
|
||||
if no_proxy = ENV[name] || ENV[name.upcase]
|
||||
|
|
Загрузка…
Ссылка в новой задаче