summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 5a22fc0015..c648f0acc4 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1080,14 +1080,29 @@ module Net #:nodoc:
end
end
- # The proxy username, if one is configured
+ # [Bug #12921]
+ if /linux|freebsd|darwin/ =~ RUBY_PLATFORM
+ ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = true
+ else
+ ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = false
+ end
+
+ # The username of the proxy server, if one is configured.
def proxy_user
- @proxy_user
+ if ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE && @proxy_from_env
+ proxy_uri&.user
+ else
+ @proxy_user
+ end
end
- # The proxy password, if one is configured
+ # 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