async-http 0.52.0 → 0.52.5

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: 66c427890a52386362f35aeecd0fbeeb36e0e8060afc549abc5c2c8d95dfd5ea
4
- data.tar.gz: 8910bc000b79e7b64861678dbfefce75d27f04b5d664008caf4ee8aef8eb584b
3
+ metadata.gz: 5f3f0a32ca906a1af82161acfe4d4256748c1d2e7a8792e9973abf7f203df7d9
4
+ data.tar.gz: 0f2e158de8e076bb7af74b3ac268e1a0260169ae2fee56925b2fd244f668f904
5
5
  SHA512:
6
- metadata.gz: 5e4bbc552ee944565da0d533f318210354bf5eff437a523d2ab02f3cbf7f1d26f98dc5e800af1b0abc2fffda9b2354f73aaa08e4bf4cf89218ae9ad3a015a061
7
- data.tar.gz: bd3149f2b69dfedc9480ec0f0a354151b64e209a2252ae6a557f443dbc5999c9be454d6e0edd3a717f42e18c97a856c494ddb1ee506e936ead0ecc580bf70d4f
6
+ metadata.gz: 53a44e49b1502fb8cb2e6d2234b7ea94831b4b6f391f9ee48c842aeea0a80f517143894fb10c98499fdbb2f1bb23994ad26d82735c9912f4333975acfdc6b1af
7
+ data.tar.gz: 53052f74772e143a831df936aad2f4687b045ae1d2ccf7bcf598d6e8b105ec3c5e47ffb20bc72ecc7fe07b6701d8f3155ba717aa6cebd065caf0506cb5ed1c70
@@ -20,18 +20,22 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  # THE SOFTWARE.
22
22
 
23
- require_relative 'wrapper'
23
+ require 'protocol/http/body/wrapper'
24
24
 
25
25
  module Async
26
26
  module HTTP
27
27
  module Body
28
- class Delayed < Async::HTTP::Body::Wrapper
28
+ class Delayed < Protocol::HTTP::Body::Wrapper
29
29
  def initialize(body, delay = 0.01)
30
30
  super(body)
31
31
 
32
32
  @delay = delay
33
33
  end
34
34
 
35
+ def ready?
36
+ false
37
+ end
38
+
35
39
  def read
36
40
  Async::Task.current.sleep(@delay)
37
41
 
@@ -59,6 +59,12 @@ module Async
59
59
  end
60
60
  end
61
61
 
62
+ def ready?
63
+ if @stream
64
+ @stream.output.ready?
65
+ end
66
+ end
67
+
62
68
  # Read the next available chunk.
63
69
  def read
64
70
  unless @task
@@ -37,8 +37,8 @@ module Async
37
37
 
38
38
  # In order for this implementation to work correctly, you need to use a LimitedQueue.
39
39
  # @param minimum_throughput [Integer] the minimum bytes per second otherwise this body will be forcefully closed.
40
- def initialize(*args, minimum_throughput: 1024, **options)
41
- super(*args, **options)
40
+ def initialize(*arguments, minimum_throughput: 1024, **options)
41
+ super(*arguments, **options)
42
42
 
43
43
  @minimum_throughput = minimum_throughput
44
44
 
@@ -68,6 +68,10 @@ module Async
68
68
  @closed
69
69
  end
70
70
 
71
+ def ready?
72
+ !@queue.empty?
73
+ end
74
+
71
75
  # Has the producer called #finish and has the reader consumed the nil token?
72
76
  def empty?
73
77
  @finished
@@ -193,8 +193,8 @@ module Async
193
193
  @endpoint ||= build_endpoint
194
194
  end
195
195
 
196
- def bind(*args, &block)
197
- endpoint.bind(*args, &block)
196
+ def bind(*arguments, &block)
197
+ endpoint.bind(*arguments, &block)
198
198
  end
199
199
 
200
200
  def connect(&block)
@@ -33,6 +33,10 @@ module Async
33
33
  @options = options
34
34
  end
35
35
 
36
+ # A cache of clients.
37
+ # @attribute [Hash(URI, Client)]
38
+ attr :clients
39
+
36
40
  def call(method, url, headers = nil, body = nil)
37
41
  endpoint = Endpoint.parse(url)
38
42
  key = host_key(endpoint)
@@ -69,7 +69,7 @@ module Async
69
69
  elsif protocol = request.protocol
70
70
  write_upgrade_body(protocol)
71
71
  else
72
- write_empty_body(request.body)
72
+ write_body(@version, body, false, trailers)
73
73
  end
74
74
 
75
75
  return Response.read(self, request)
@@ -56,7 +56,7 @@ module Async
56
56
 
57
57
  # Server loop.
58
58
  def each(task: Task.current)
59
- task.annotate("Reading #{version} requests for #{self.class}.")
59
+ task.annotate("Reading #{self.version} requests for #{self.class}.")
60
60
 
61
61
  while request = next_request
62
62
  response = yield(request, self)
@@ -90,16 +90,17 @@ module Async
90
90
  body.call(stream)
91
91
  else
92
92
  head = request.head?
93
+ version = request.version
93
94
 
94
95
  request = nil unless body
95
96
  response = nil
96
97
 
97
- write_body(@version, body, head, trailers)
98
+ write_body(version, body, head, trailers)
98
99
  end
99
100
  else
100
101
  # If the request failed to generate a response, it was an internal server error:
101
102
  write_response(@version, 500, {})
102
- write_body(@version, nil)
103
+ write_body(request.version, nil)
103
104
  end
104
105
 
105
106
  # Gracefully finish reading the request body if it was not already done so.
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Async
24
24
  module HTTP
25
- VERSION = "0.52.0"
25
+ VERSION = "0.52.5"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.0
4
+ version: 0.52.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2020-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.18.0
61
+ version: 0.20.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.18.0
68
+ version: 0.20.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: protocol-http1
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.12.0
75
+ version: 0.13.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.12.0
82
+ version: 0.13.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: protocol-http2
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,47 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.14.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: async-rspec
98
+ name: async-container
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.10'
103
+ version: '0.14'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.10'
110
+ version: '0.14'
111
111
  - !ruby/object:Gem::Dependency
112
- name: async-container
112
+ name: async-rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.14.0
117
+ version: '1.10'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.14.0
125
- - !ruby/object:Gem::Dependency
126
- name: rack-test
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
124
+ version: '1.10'
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: covered
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -151,21 +137,7 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: bundler
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: bake-bundler
140
+ name: rack-test
169
141
  requirement: !ruby/object:Gem::Requirement
170
142
  requirements:
171
143
  - - ">="
@@ -192,42 +164,14 @@ dependencies:
192
164
  - - "~>"
193
165
  - !ruby/object:Gem::Version
194
166
  version: '3.6'
195
- description:
167
+ description:
196
168
  email:
197
- - samuel.williams@oriontransfer.co.nz
198
169
  executables: []
199
170
  extensions: []
200
171
  extra_rdoc_files: []
201
172
  files:
202
- - ".editorconfig"
203
- - ".github/workflows/development.yml"
204
- - ".gitignore"
205
- - ".rspec"
206
- - ".travis.yml"
207
- - Gemfile
208
- - README.md
209
- - async-http.gemspec
210
- - bake.rb
211
173
  - bake/async/http.rb
212
174
  - bake/async/http/h2spec.rb
213
- - examples/compare/Gemfile
214
- - examples/compare/benchmark.rb
215
- - examples/download/chunked.rb
216
- - examples/fetch/Gemfile
217
- - examples/fetch/Gemfile.lock
218
- - examples/fetch/README.md
219
- - examples/fetch/config.ru
220
- - examples/fetch/public/index.html
221
- - examples/fetch/public/stream.js
222
- - examples/google/search.rb
223
- - examples/request.rb
224
- - examples/stream/stop.rb
225
- - examples/trenni/Gemfile
226
- - examples/trenni/streaming.rb
227
- - examples/upload/client.rb
228
- - examples/upload/data.txt
229
- - examples/upload/server.rb
230
- - examples/upload/upload.rb
231
175
  - lib/async/http.rb
232
176
  - lib/async/http/body.rb
233
177
  - lib/async/http/body/delayed.rb
@@ -270,7 +214,7 @@ homepage: https://github.com/socketry/async-http
270
214
  licenses:
271
215
  - MIT
272
216
  metadata: {}
273
- post_install_message:
217
+ post_install_message:
274
218
  rdoc_options: []
275
219
  require_paths:
276
220
  - lib
@@ -285,8 +229,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
229
  - !ruby/object:Gem::Version
286
230
  version: '0'
287
231
  requirements: []
288
- rubygems_version: 3.1.2
289
- signing_key:
232
+ rubygems_version: 3.0.3
233
+ signing_key:
290
234
  specification_version: 4
291
235
  summary: A HTTP client and server library.
292
236
  test_files: []
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
@@ -1,52 +0,0 @@
1
- name: Development
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- test:
7
- runs-on: ${{matrix.os}}-latest
8
- continue-on-error: ${{matrix.experimental}}
9
-
10
- strategy:
11
- matrix:
12
- experimental: [false]
13
-
14
- os:
15
- - ubuntu
16
- - macos
17
-
18
- ruby:
19
- - 2.5
20
- - 2.6
21
- - 2.7
22
-
23
- include:
24
- - experimental: true
25
- os: ubuntu
26
- ruby: truffleruby
27
- - experimental: true
28
- os: ubuntu
29
- ruby: jruby
30
- - experimental: true
31
- os: ubuntu
32
- ruby: head
33
- - experimental: true
34
- os: ubuntu
35
- ruby: 2.6
36
- env: COVERAGE=PartialSummary,Coveralls
37
-
38
- steps:
39
- - uses: actions/checkout@v1
40
- - uses: ruby/setup-ruby@v1
41
- with:
42
- ruby-version: ${{matrix.ruby}}
43
-
44
- - name: Installing packages (ubuntu)
45
- if: matrix.os == 'ubuntu'
46
- run: sudo apt-get install apache2-utils
47
-
48
- - name: Install dependencies
49
- run: ${{matrix.env}} bundle install
50
-
51
- - name: Run tests
52
- run: ${{matrix.env}} bundle exec rspec
data/.gitignore DELETED
@@ -1,15 +0,0 @@
1
- .tags
2
-
3
- /.bundle/
4
- /.yardoc
5
- /Gemfile.lock
6
- /_yardoc/
7
- /coverage/
8
- /doc/
9
- /pkg/
10
- /spec/reports/
11
- /tmp/
12
-
13
- .rspec_status
14
- .covered.db
15
- /h2spec
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
@@ -1,35 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- addons:
6
- apt:
7
- packages:
8
- - wrk
9
- - apache2-utils
10
- homebrew:
11
- packages:
12
- - wrk
13
-
14
- script: bundle exec rspec
15
-
16
- matrix:
17
- include:
18
- - rvm: 2.5
19
- - rvm: 2.6
20
- - rvm: 2.7
21
- - rvm: 2.6
22
- env: COVERAGE=PartialSummary,Coveralls
23
- - rvm: truffleruby
24
- - rvm: jruby-head
25
- env: JRUBY_OPTS="--debug -X+O"
26
- - rvm: ruby-head
27
- - rvm: 2.7
28
- os: osx
29
- allow_failures:
30
- - rvm: ruby-head
31
- - rvm: jruby-head
32
- - rvm: truffleruby
33
-
34
- # after_success:
35
- # - bundle exec rake h2spec:all