Skip to content

Commit a4ecbbb

Browse files
committed
Use JSE properties for proxy defaults (JRuby GH ruby#195)
1 parent f33923d commit a4ecbbb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/net/http.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,16 @@ def do_finish
637637
# # connecting proxy.foo.org:8080
638638
# :
639639
# }
640+
#
641+
# In JRuby, this will default to the JSE proxy settings provided in the
642+
# 'http.proxyHost' and 'http.proxyPort' Java system properties, if they
643+
# are set and no alternative proxy has been provided.
640644
#
641645
def HTTP.Proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil)
646+
j_addr = ENV_JAVA['http.proxyHost']
647+
j_port = ENV_JAVA['http.proxyPort']
648+
p_addr = p_addr || j_addr
649+
p_port = p_port || j_port
642650
return self unless p_addr
643651
delta = ProxyDelta
644652
proxyclass = Class.new(self)

0 commit comments

Comments
 (0)