Skip to content

Commit 4cb8246

Browse files
authored
Merge pull request #88 from jakauppila/fix_no_proxy
Add explicit nil proxy arguments - Corrects no_proxy support
2 parents 585e090 + bb48bc8 commit 4cb8246

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/net/http/persistent.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,11 @@ def connection_for uri
635635

636636
net_http_args = [uri.host, uri.port]
637637

638-
net_http_args.concat @proxy_args if
639-
@proxy_uri and not proxy_bypass? uri.host, uri.port
638+
if @proxy_uri and not proxy_bypass? uri.host, uri.port then
639+
net_http_args.concat @proxy_args
640+
else
641+
net_http_args.concat [nil, nil, nil, nil]
642+
end
640643

641644
connection = @pool.checkout net_http_args
642645

test/test_net_http_persistent.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def proxy_port
120120
def basic_connection
121121
raise "#{@uri} is not HTTP" unless @uri.scheme.downcase == 'http'
122122

123-
net_http_args = [@uri.host, @uri.port]
123+
net_http_args = [@uri.host, @uri.port, nil, nil, nil, nil]
124124

125125
connection = Net::HTTP::Persistent::Connection.allocate
126126
connection.ssl_generation = @http.ssl_generation
@@ -152,7 +152,7 @@ def r.read_body() :read_body end
152152
def ssl_connection
153153
raise "#{@uri} is not HTTPS" unless @uri.scheme.downcase == 'https'
154154

155-
net_http_args = [@uri.host, @uri.port]
155+
net_http_args = [@uri.host, @uri.port, nil, nil, nil, nil]
156156

157157
connection = Net::HTTP::Persistent::Connection.allocate
158158
connection.ssl_generation = @http.ssl_generation
@@ -279,7 +279,7 @@ def test_connection_for
279279
c
280280
end
281281

282-
stored = @http.pool.checkout ['example.com', 80]
282+
stored = @http.pool.checkout ['example.com', 80, nil, nil, nil, nil]
283283

284284
assert_same used, stored
285285
end

0 commit comments

Comments
 (0)