async-http 0.56.3 → 0.56.4

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
  SHA256:
3
- metadata.gz: efbee0417c7ab944ad2ec6b6bd2c29735924d821b2396b02e78a6826874aa644
4
- data.tar.gz: '08abaadc604cba6bb2ade84fd1387f962bab03c915f613c69cd5a1588666b431'
3
+ metadata.gz: caff6f0e39afa2ec8e8eaff86fc960121968f136fd23bee8e4c4344e1da55c36
4
+ data.tar.gz: 8428ae61665e4bc9275cf1a127006c9c975cc184267a1ac0a35b9b7df80d608f
5
5
  SHA512:
6
- metadata.gz: 60cf32dd530b64e7919047f662ba3a94a81a05328a404c5e51e9d45f0f8a379f59462b7d04e52aa2a8e83d42df44605866aec128b87a8528d233ec1ecc8d44fc
7
- data.tar.gz: 3c62522dbe7bb6915cf2d6613d356515911ebb63e5036c643073632b0571f62be2d254177fbf6565eb0044c31d3c21b5195cc98d6a43b5cf687851cdd531eebd
6
+ metadata.gz: 761f315b4fc933cb92d80eb9000e2f5dd2c796bc9e119265ee452f27f0edabc071766e4d48e35dd1866661d315166b7e32fb509348ec5c9cb43c38c5d1b4586f
7
+ data.tar.gz: 0b229bf87de21d7cc05de022283901f75114bf37acc240e7992430c5e47602ab04f8b9aa76884b30733f55a1b52b0d3ae51b9dc0e25ea1a653dfda680e77a1ce
@@ -31,7 +31,7 @@ module Async
31
31
  module HTTP
32
32
  class Internet
33
33
  def initialize(**options)
34
- @clients = {}
34
+ @clients = Hash.new
35
35
  @options = options
36
36
  end
37
37
 
@@ -39,13 +39,17 @@ module Async
39
39
  # @attribute [Hash(URI, Client)]
40
40
  attr :clients
41
41
 
42
- def call(method, url, headers = nil, body = nil)
43
- endpoint = Endpoint.parse(url)
42
+ def client_for(endpoint)
44
43
  key = host_key(endpoint)
45
44
 
46
- client = @clients.fetch(key) do
47
- @clients[key] = self.client_for(endpoint)
45
+ @clients.fetch(key) do
46
+ @clients[key] = self.make_client(endpoint)
48
47
  end
48
+ end
49
+
50
+ def call(method, url, headers = nil, body = nil)
51
+ endpoint = Endpoint.parse(url)
52
+ client = self.client_for(endpoint)
49
53
 
50
54
  body = Body::Buffered.wrap(body)
51
55
  headers = ::Protocol::HTTP::Headers[headers]
@@ -55,12 +59,6 @@ module Async
55
59
  return client.call(request)
56
60
  end
57
61
 
58
- def client_for(endpoint)
59
- ::Protocol::HTTP::AcceptEncoding.new(
60
- Client.new(endpoint, **@options)
61
- )
62
- end
63
-
64
62
  def close
65
63
  # The order of operations here is to avoid a race condition between iterating over clients (#close may yield) and creating new clients.
66
64
  clients = @clients.values
@@ -75,7 +73,13 @@ module Async
75
73
  end
76
74
  end
77
75
 
78
- private
76
+ protected
77
+
78
+ def make_client(endpoint)
79
+ ::Protocol::HTTP::AcceptEncoding.new(
80
+ Client.new(endpoint, **@options)
81
+ )
82
+ end
79
83
 
80
84
  def host_key(endpoint)
81
85
  url = endpoint.url.dup
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Async
24
24
  module HTTP
25
- VERSION = "0.56.3"
25
+ VERSION = "0.56.4"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.56.3
4
+ version: 0.56.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-04 00:00:00.000000000 Z
11
+ date: 2021-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.25'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.25'
27
27
  - !ruby/object:Gem::Dependency
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.3.0.dev
247
+ rubygems_version: 3.2.22
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: A HTTP client and server library.