mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Allow Net::HTTP to fetch user/pass from http_proxy
Note that this feature is enabled only on environment variables are multi-user safe. In this time the list includes Linux, FreeBSD, or Darwin. [Bug #12921] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ece9698d73
commit
c7ec1b1f59
3 changed files with 42 additions and 5 deletions
|
@ -1080,14 +1080,29 @@ module Net #:nodoc:
|
|||
end
|
||||
end
|
||||
|
||||
# The proxy username, if one is configured
|
||||
def proxy_user
|
||||
@proxy_user
|
||||
# [Bug #12921]
|
||||
if /linux|freebsd|darwin/ =~ RUBY_PLATFORM
|
||||
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = true
|
||||
else
|
||||
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = false
|
||||
end
|
||||
|
||||
# The proxy password, if one is configured
|
||||
# The username of the proxy server, if one is configured.
|
||||
def proxy_user
|
||||
if ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE && @proxy_from_env
|
||||
proxy_uri&.user
|
||||
else
|
||||
@proxy_user
|
||||
end
|
||||
end
|
||||
|
||||
# The password of the proxy server, if one is configured.
|
||||
def proxy_pass
|
||||
@proxy_pass
|
||||
if ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE && @proxy_from_env
|
||||
proxy_uri&.password
|
||||
else
|
||||
@proxy_pass
|
||||
end
|
||||
end
|
||||
|
||||
alias proxyaddr proxy_address #:nodoc: obsolete
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue