mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/open-uri.rb (URI::Generic#find_proxy): use CGI_HTTP_PROXY
instead of HTTP_PROXY in the CGI environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9421725f53
commit
087a8db4d2
2 changed files with 15 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Nov 24 19:59:48 2003 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
|
* lib/open-uri.rb (URI::Generic#find_proxy): use CGI_HTTP_PROXY
|
||||||
|
instead of HTTP_PROXY in the CGI environment.
|
||||||
|
|
||||||
Mon Nov 24 19:32:55 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Nov 24 19:32:55 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* ext/etc/extconf.rb: check for pw_passwd in struct passwd and
|
* ext/etc/extconf.rb: check for pw_passwd in struct passwd and
|
||||||
|
|
|
@ -312,7 +312,7 @@ module OpenURI
|
||||||
elsif block_given?
|
elsif block_given?
|
||||||
yield
|
yield
|
||||||
elsif type && %r{\Atext/} =~ type &&
|
elsif type && %r{\Atext/} =~ type &&
|
||||||
@base_uri && @base_uri.scheme == 'http'
|
@base_uri && /\Ahttp\z/i =~ @base_uri.scheme
|
||||||
"iso-8859-1" # RFC2616 3.7.1
|
"iso-8859-1" # RFC2616 3.7.1
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
|
@ -434,8 +434,16 @@ module URI
|
||||||
# The proxy URI is obtained from environment variables such as http_proxy,
|
# The proxy URI is obtained from environment variables such as http_proxy,
|
||||||
# ftp_proxy, no_proxy, etc.
|
# ftp_proxy, no_proxy, etc.
|
||||||
# If there is no proper proxy, nil is returned.
|
# 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.
|
||||||
def find_proxy
|
def find_proxy
|
||||||
name = self.scheme + '_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
|
||||||
|
end
|
||||||
if proxy_uri = ENV[name] || ENV[name.upcase]
|
if proxy_uri = ENV[name] || ENV[name.upcase]
|
||||||
proxy_uri = URI.parse(proxy_uri)
|
proxy_uri = URI.parse(proxy_uri)
|
||||||
name = 'no_proxy'
|
name = 'no_proxy'
|
||||||
|
|
Loading…
Reference in a new issue