Skip to content

Commit 3bd2bcc

Browse files
headiusjeremyevans
authored andcommitted
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
1 parent 44004f1 commit 3bd2bcc

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/uri/generic.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,9 +1514,19 @@ def find_proxy(env=ENV)
15141514
proxy_uri = env["CGI_#{name.upcase}"]
15151515
end
15161516
elsif name == 'http_proxy'
1517-
unless proxy_uri = env[name]
1518-
if proxy_uri = env[name.upcase]
1519-
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
1517+
if RUBY_ENGINE == 'jruby' && p_addr = ENV_JAVA['http.proxyHost']
1518+
p_port = ENV_JAVA['http.proxyPort']
1519+
if p_user = ENV_JAVA['http.proxyUser']
1520+
p_pass = ENV_JAVA['http.proxyPass']
1521+
proxy_uri = "http://#{p_user}:#{p_pass}@#{p_addr}:#{p_port}"
1522+
else
1523+
proxy_uri = "http://#{p_addr}:#{p_port}"
1524+
end
1525+
else
1526+
unless proxy_uri = env[name]
1527+
if proxy_uri = env[name.upcase]
1528+
warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
1529+
end
15201530
end
15211531
end
15221532
else

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy