Skip to content

Commit 3b8471d

Browse files
authored
Merge pull request #66 from jeremyevans/always-allow-env-18908
Remove ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE
2 parents 196f3d7 + 1e45851 commit 3b8471d

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

lib/net/http.rb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,16 +1221,9 @@ def proxy_port
12211221
end
12221222
end
12231223

1224-
# [Bug #12921]
1225-
if /linux|freebsd|darwin/ =~ RUBY_PLATFORM
1226-
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = true
1227-
else
1228-
ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE = false
1229-
end
1230-
12311224
# The username of the proxy server, if one is configured.
12321225
def proxy_user
1233-
if ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE && @proxy_from_env
1226+
if @proxy_from_env
12341227
user = proxy_uri&.user
12351228
unescape(user) if user
12361229
else
@@ -1240,7 +1233,7 @@ def proxy_user
12401233

12411234
# The password of the proxy server, if one is configured.
12421235
def proxy_pass
1243-
if ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE && @proxy_from_env
1236+
if @proxy_from_env
12441237
pass = proxy_uri&.password
12451238
unescape(pass) if pass
12461239
else

test/net/http/test_http.rb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,8 @@ def test_proxy_eh_ENV_with_user
178178
http = Net::HTTP.new 'hostname.example'
179179

180180
assert_equal true, http.proxy?
181-
if Net::HTTP::ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE
182-
assert_equal 'foo', http.proxy_user
183-
assert_equal 'bar', http.proxy_pass
184-
else
185-
assert_nil http.proxy_user
186-
assert_nil http.proxy_pass
187-
end
181+
assert_equal 'foo', http.proxy_user
182+
assert_equal 'bar', http.proxy_pass
188183
end
189184
end
190185

@@ -195,13 +190,8 @@ def test_proxy_eh_ENV_with_urlencoded_user
195190
http = Net::HTTP.new 'hostname.example'
196191

197192
assert_equal true, http.proxy?
198-
if Net::HTTP::ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE
199-
assert_equal "Y\\X", http.proxy_user
200-
assert_equal "R%S] ?X", http.proxy_pass
201-
else
202-
assert_nil http.proxy_user
203-
assert_nil http.proxy_pass
204-
end
193+
assert_equal "Y\\X", http.proxy_user
194+
assert_equal "R%S] ?X", http.proxy_pass
205195
end
206196
end
207197

0 commit comments

Comments
 (0)