[ruby/uri] Upstream Java proxy property checks from JRuby
These Java properties, retrieved from JRuby's "Java env" ENV_JAVA, allow JRuby users to use the same proxy properties the rest of the Java platform uses. This resolves https://bugs.ruby-lang.org/issues/11194 https://github.com/ruby/uri/commit/3bd2bcc95a
This commit is contained in:
parent
a9fe00c3ba
commit
6e06c980da
@ -1514,11 +1514,21 @@ module URI
|
||||
proxy_uri = env["CGI_#{name.upcase}"]
|
||||
end
|
||||
elsif name == 'http_proxy'
|
||||
if RUBY_ENGINE == 'jruby' && p_addr = ENV_JAVA['http.proxyHost']
|
||||
p_port = ENV_JAVA['http.proxyPort']
|
||||
if p_user = ENV_JAVA['http.proxyUser']
|
||||
p_pass = ENV_JAVA['http.proxyPass']
|
||||
proxy_uri = "http://#{p_user}:#{p_pass}@#{p_addr}:#{p_port}"
|
||||
else
|
||||
proxy_uri = "http://#{p_addr}:#{p_port}"
|
||||
end
|
||||
else
|
||||
unless proxy_uri = env[name]
|
||||
if proxy_uri = env[name.upcase]
|
||||
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
proxy_uri = env[name] || env[name.upcase]
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user