Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/net/http/persistent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,8 @@ def connection_for uri
if @proxy_uri and not proxy_bypass? uri.host, uri.port then
connection_id << @proxy_connection_id
net_http_args.concat @proxy_args
elsif proxy_bypass? uri.host, uri.port then
net_http_args.concat [nil]
end

connection = connections[connection_id]
Expand Down
15 changes: 15 additions & 0 deletions test/test_net_http_persistent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,21 @@ def test_proxy_bypass_double_comma
refute @http.proxy_bypass? 'example.org', 80
end

def test_connection_for_no_proxy_from_env
ENV['http_proxy'] = 'proxy.example'
ENV['no_proxy'] = 'localhost, example.com,'
ENV['proxy_user'] = 'johndoe'
ENV['proxy_password'] = 'muffins'

http = Net::HTTP::Persistent.new nil, :ENV

c = http.connection_for @uri

assert c.started?
refute c.proxy?
refute c.proxy_from_env? unless RUBY_1
end

def test_reconnect
result = @http.reconnect

Expand Down