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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 771acb2edff044696f9e195d3202271260a569f7
4
- data.tar.gz: 5617d4406cec82b2f75b45e41e8427820517cb63
3
+ metadata.gz: c825be1948756d9856d5cd4546538e259d9f2c50
4
+ data.tar.gz: e93d9f59d953cc2c4e2b11f437e0ef54fcda7942
5
5
  SHA512:
6
- metadata.gz: f514e9afe456b7ef7cd7eef592a7fdcdcf87bf8be1fba379d66c0c3a9e49b9fa0db5f86a627fabedfec8ce309c3664dc4b700e78012595bb54486105d8c9c381
7
- data.tar.gz: 98180add149e8044321acd86337230b8424f5e8cd8c04ecc3eea819f924dd9a69c257391e8b535afd787e8251b1961e82a690270c9a54dad4d862a7772072ad2
6
+ metadata.gz: b3f335e8bd447c2886ab599c8271623e636e0cc368f439ac961606e4ed71481ea9467cffed271f91f187e850cecd071872c578b3c3d4c866bf38186b1d6a47fc
7
+ data.tar.gz: 0daf288fb6105cf9b96bd3d0663bfa1dc3e083707583fcf4f9a33c45e8fe186b355073ed643064769cdd7362ee27fb89cb47bad912c5fd5ba2cc752206191b2f
@@ -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 = open(req, via_proxy)
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
- def open(req, via_proxy = false)
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
- sess = Session.new(@client, site, @agent_name, @from)
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|
@@ -1,3 +1,3 @@
1
1
  class HTTPClient
2
- VERSION = '2.5.3'
2
+ VERSION = '2.5.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi Nakamura