httpclient 2.5.3 → 2.5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/httpclient/session.rb +26 -18
- data/lib/httpclient/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c825be1948756d9856d5cd4546538e259d9f2c50
|
4
|
+
data.tar.gz: e93d9f59d953cc2c4e2b11f437e0ef54fcda7942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3f335e8bd447c2886ab599c8271623e636e0cc368f439ac961606e4ed71481ea9467cffed271f91f187e850cecd071872c578b3c3d4c866bf38186b1d6a47fc
|
7
|
+
data.tar.gz: 0daf288fb6105cf9b96bd3d0663bfa1dc3e083707583fcf4f9a33c45e8fe186b355073ed643064769cdd7362ee27fb89cb47bad912c5fd5ba2cc752206191b2f
|
data/lib/httpclient/session.rb
CHANGED
@@ -159,7 +159,7 @@ class HTTPClient
|
|
159
159
|
|
160
160
|
def query(req, via_proxy)
|
161
161
|
req.http_body.chunk_size = @chunk_size if req.http_body
|
162
|
-
sess =
|
162
|
+
sess = get_session(req, via_proxy)
|
163
163
|
begin
|
164
164
|
sess.query(req)
|
165
165
|
rescue
|
@@ -195,30 +195,38 @@ class HTTPClient
|
|
195
195
|
|
196
196
|
private
|
197
197
|
|
198
|
-
|
198
|
+
# TODO: create PR for webmock's httpclient adapter to use get_session
|
199
|
+
# instead of open so that we can remove duplicated Site creation for
|
200
|
+
# each session.
|
201
|
+
def get_session(req, via_proxy = false)
|
199
202
|
site = Site.new(req.header.request_uri)
|
200
203
|
if req.use_persistent_connection? && cached = get_cached_session(site)
|
201
204
|
cached
|
202
205
|
else
|
203
|
-
|
204
|
-
sess.proxy = via_proxy ? @proxy : nil
|
205
|
-
sess.socket_sync = @socket_sync
|
206
|
-
sess.requested_version = @protocol_version if @protocol_version
|
207
|
-
sess.connect_timeout = @connect_timeout
|
208
|
-
sess.connect_retry = @connect_retry
|
209
|
-
sess.send_timeout = @send_timeout
|
210
|
-
sess.receive_timeout = @receive_timeout
|
211
|
-
sess.read_block_size = @read_block_size
|
212
|
-
sess.protocol_retry_count = @protocol_retry_count
|
213
|
-
sess.ssl_config = @ssl_config
|
214
|
-
sess.debug_dev = @debug_dev
|
215
|
-
sess.socket_local = @socket_local
|
216
|
-
sess.test_loopback_http_response = @test_loopback_http_response
|
217
|
-
sess.transparent_gzip_decompression = @transparent_gzip_decompression
|
218
|
-
sess
|
206
|
+
open(req.header.request_uri, via_proxy)
|
219
207
|
end
|
220
208
|
end
|
221
209
|
|
210
|
+
def open(uri, via_proxy = false)
|
211
|
+
site = Site.new(uri)
|
212
|
+
sess = Session.new(@client, site, @agent_name, @from)
|
213
|
+
sess.proxy = via_proxy ? @proxy : nil
|
214
|
+
sess.socket_sync = @socket_sync
|
215
|
+
sess.requested_version = @protocol_version if @protocol_version
|
216
|
+
sess.connect_timeout = @connect_timeout
|
217
|
+
sess.connect_retry = @connect_retry
|
218
|
+
sess.send_timeout = @send_timeout
|
219
|
+
sess.receive_timeout = @receive_timeout
|
220
|
+
sess.read_block_size = @read_block_size
|
221
|
+
sess.protocol_retry_count = @protocol_retry_count
|
222
|
+
sess.ssl_config = @ssl_config
|
223
|
+
sess.debug_dev = @debug_dev
|
224
|
+
sess.socket_local = @socket_local
|
225
|
+
sess.test_loopback_http_response = @test_loopback_http_response
|
226
|
+
sess.transparent_gzip_decompression = @transparent_gzip_decompression
|
227
|
+
sess
|
228
|
+
end
|
229
|
+
|
222
230
|
def close_all
|
223
231
|
@sess_pool_mutex.synchronize do
|
224
232
|
@sess_pool.each do |site, pool|
|
data/lib/httpclient/version.rb
CHANGED