async-http 0.60.2 → 0.61.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/http/body/delayed.rb +2 -1
- data/lib/async/http/protocol/http1/request.rb +4 -0
- data/lib/async/http/protocol/http1/response.rb +12 -4
- data/lib/async/http/protocol/http1/server.rb +7 -2
- data/lib/async/http/protocol/http2/request.rb +10 -0
- data/lib/async/http/protocol/http2/response.rb +6 -0
- data/lib/async/http/protocol/http2/stream.rb +4 -6
- data/lib/async/http/protocol/request.rb +3 -0
- data/lib/async/http/version.rb +1 -1
- data/license.md +1 -0
- data/readme.md +8 -0
- data.tar.gz.sig +3 -5
- metadata +9 -92
- metadata.gz.sig +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7cae098a41e0baff0683a5cd61f620df474d69e07f3aec081a9460e7eeb4efb
|
4
|
+
data.tar.gz: 46f0c3eb2ae7b8b1d008df29e4a73ee40b35a301dba47f21091b010ba340b1ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71080112751d4f8fe86b4b3b4cd6edf4fe1e1d5ecb6d5832baab507f623dbf901395a5047f0b4e28e26456593e8349cd487bf82d9c6a47bae38e26127b2f86d8
|
7
|
+
data.tar.gz: c0dfc8d18959882748664fdf2d5d0d43cced5c6bd8fd1475ea77f3844f4b8ea65311033b870f9ad16345f5683292ba02d25c132f999639957606eb43fcb94c16
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -3,13 +3,14 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2023, by Samuel Williams.
|
5
5
|
# Copyright, 2020, by Bruno Sutic.
|
6
|
+
# Copyright, 2023, by Thomas Morgan.
|
6
7
|
|
7
8
|
require 'protocol/http/body/wrapper'
|
8
9
|
|
9
10
|
module Async
|
10
11
|
module HTTP
|
11
12
|
module Body
|
12
|
-
class Delayed < Protocol::HTTP::Body::Wrapper
|
13
|
+
class Delayed < ::Protocol::HTTP::Body::Wrapper
|
13
14
|
def initialize(body, delay = 0.01)
|
14
15
|
super(body)
|
15
16
|
|
@@ -11,16 +11,24 @@ module Async
|
|
11
11
|
module HTTP1
|
12
12
|
class Response < Protocol::Response
|
13
13
|
def self.read(connection, request)
|
14
|
-
|
15
|
-
self.new(connection, *parts)
|
14
|
+
while parts = connection.read_response(request.method)
|
15
|
+
response = self.new(connection, *parts)
|
16
|
+
|
17
|
+
if response.final?
|
18
|
+
return response
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
19
23
|
UPGRADE = 'upgrade'
|
20
|
-
|
21
|
-
# @
|
24
|
+
|
25
|
+
# @attribute [String] The HTTP response line reason.
|
26
|
+
attr :reason
|
27
|
+
|
28
|
+
# @parameter reason [String] HTTP response line reason phrase.
|
22
29
|
def initialize(connection, version, status, reason, headers, body)
|
23
30
|
@connection = connection
|
31
|
+
@reason = reason
|
24
32
|
|
25
33
|
protocol = headers.delete(UPGRADE)
|
26
34
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2023, by Samuel Williams.
|
5
5
|
# Copyright, 2020, by Igor Sidorov.
|
6
|
+
# Copyright, 2023, by Thomas Morgan.
|
6
7
|
|
7
8
|
require_relative 'connection'
|
8
9
|
|
@@ -14,6 +15,9 @@ module Async
|
|
14
15
|
def fail_request(status)
|
15
16
|
@persistent = false
|
16
17
|
write_response(@version, status, {}, nil)
|
18
|
+
write_body(@version, nil)
|
19
|
+
rescue Errno::ECONNRESET, Errno::EPIPE
|
20
|
+
# Handle when connection is already closed
|
17
21
|
end
|
18
22
|
|
19
23
|
def next_request
|
@@ -79,7 +83,7 @@ module Async
|
|
79
83
|
version = request.version
|
80
84
|
|
81
85
|
# Same as above:
|
82
|
-
request = nil unless body
|
86
|
+
request = nil unless request.body
|
83
87
|
response = nil
|
84
88
|
|
85
89
|
write_body(version, body, head, trailer)
|
@@ -94,7 +98,7 @@ module Async
|
|
94
98
|
end
|
95
99
|
|
96
100
|
# Gracefully finish reading the request body if it was not already done so.
|
97
|
-
request&.
|
101
|
+
request&.each{}
|
98
102
|
|
99
103
|
# This ensures we yield at least once every iteration of the loop and allow other fibers to execute.
|
100
104
|
task.yield
|
@@ -105,6 +109,7 @@ module Async
|
|
105
109
|
end
|
106
110
|
end
|
107
111
|
end
|
112
|
+
|
108
113
|
end
|
109
114
|
end
|
110
115
|
end
|
@@ -141,6 +141,16 @@ module Async
|
|
141
141
|
@stream.send_headers(nil, headers, ::Protocol::HTTP2::END_STREAM)
|
142
142
|
end
|
143
143
|
end
|
144
|
+
|
145
|
+
def write_interim_response(response)
|
146
|
+
protocol_headers = [
|
147
|
+
[STATUS, response.status]
|
148
|
+
]
|
149
|
+
|
150
|
+
headers = ::Protocol::HTTP::Headers::Merged.new(protocol_headers, response.headers)
|
151
|
+
|
152
|
+
@stream.send_headers(nil, headers)
|
153
|
+
end
|
144
154
|
end
|
145
155
|
end
|
146
156
|
end
|
@@ -39,7 +39,13 @@ module Async
|
|
39
39
|
# This should be invoked from the background reader, and notifies the task waiting for the headers that we are done.
|
40
40
|
def receive_initial_headers(headers, end_stream)
|
41
41
|
headers.each do |key, value|
|
42
|
+
# It's guaranteed that this should be the first header:
|
42
43
|
if key == STATUS
|
44
|
+
status = Integer(value)
|
45
|
+
|
46
|
+
# Ignore informational headers:
|
47
|
+
return if status >= 100 && status < 200
|
48
|
+
|
43
49
|
@response.status = Integer(value)
|
44
50
|
elsif key == PROTOCOL
|
45
51
|
@response.protocol = value
|
@@ -50,13 +50,11 @@ module Async
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def process_headers(frame)
|
53
|
-
if @headers
|
54
|
-
@headers = ::Protocol::HTTP::Headers.new
|
55
|
-
self.receive_initial_headers(super, frame.end_stream?)
|
56
|
-
elsif frame.end_stream?
|
53
|
+
if frame.end_stream? && @headers
|
57
54
|
self.receive_trailing_headers(super, frame.end_stream?)
|
58
55
|
else
|
59
|
-
|
56
|
+
@headers ||= ::Protocol::HTTP::Headers.new
|
57
|
+
self.receive_initial_headers(super, frame.end_stream?)
|
60
58
|
end
|
61
59
|
|
62
60
|
# TODO this might need to be in an ensure block:
|
@@ -65,7 +63,7 @@ module Async
|
|
65
63
|
@input = nil
|
66
64
|
end
|
67
65
|
rescue ::Protocol::HTTP2::HeaderError => error
|
68
|
-
Console.logger.
|
66
|
+
Console.logger.debug(self, error)
|
69
67
|
|
70
68
|
send_reset_stream(error.code)
|
71
69
|
end
|
data/lib/async/http/version.rb
CHANGED
data/license.md
CHANGED
@@ -17,6 +17,7 @@ Copyright, 2021-2022, by Adam Daniels.
|
|
17
17
|
Copyright, 2022, by Ian Ker-Seymer.
|
18
18
|
Copyright, 2022, by Marco Concetto Rudilosso.
|
19
19
|
Copyright, 2022, by Tim Meusel.
|
20
|
+
Copyright, 2023, by Thomas Morgan.
|
20
21
|
|
21
22
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
22
23
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
@@ -367,6 +367,14 @@ We welcome contributions to this project.
|
|
367
367
|
4. Push to the branch (`git push origin my-new-feature`).
|
368
368
|
5. Create new Pull Request.
|
369
369
|
|
370
|
+
### Developer Certificate of Origin
|
371
|
+
|
372
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
373
|
+
|
374
|
+
### Contributor Covenant
|
375
|
+
|
376
|
+
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
377
|
+
|
370
378
|
## See Also
|
371
379
|
|
372
380
|
- [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
|
data.tar.gz.sig
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
��b�ܩO|��$W�/�3COǪ�v>/��7H��tP��u�q��`m_;�0Zm��t���Җk�r�"wNa��f�*\�~�{>S�܊��{]ܥFF�3��
|
5
|
-
d$"�+ c �Ԁ�#��D�~���j�?k���p�$qV~�W���Y#JjV��
|
1
|
+
�U�����5�����t:�C�����6��[s�ˎ��6U�FV"r�'e�A�2�8\/�"q��k�O}����S]���_B
|
2
|
+
�o�N�A�o� lH�? L�NW��(X�7s��Ȕ��I��ܽ�e$�rҤ�XP����Α�z?�@8 �tm�! .bȬ~ݛ!1rw��ҕ6#��6�Hp���)A<Zv�X����Eެ��/(c!4#�W�F��1����E�8/�ъ%�!���ZVֿ�|�k+� ��u-j�5+�)�F:�Lbd��
|
3
|
+
���7�{K�f�Jm�Y�����R'�.8y`Gv�Kv���V�r��LV�Hٛr�j�Ԧ���T>z Z�m������:������!�!^�*��a\N8��X
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.61.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -9,6 +9,7 @@ authors:
|
|
9
9
|
- Bruno Sutic
|
10
10
|
- Janko Marohnić
|
11
11
|
- Adam Daniels
|
12
|
+
- Thomas Morgan
|
12
13
|
- Cyril Roelandt
|
13
14
|
- Denis Talakevich
|
14
15
|
- Ian Ker-Seymer
|
@@ -53,7 +54,7 @@ cert_chain:
|
|
53
54
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
54
55
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
55
56
|
-----END CERTIFICATE-----
|
56
|
-
date: 2023-
|
57
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
57
58
|
dependencies:
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
60
|
name: async
|
@@ -103,28 +104,28 @@ dependencies:
|
|
103
104
|
requirements:
|
104
105
|
- - "~>"
|
105
106
|
- !ruby/object:Gem::Version
|
106
|
-
version: 0.
|
107
|
+
version: 0.25.0
|
107
108
|
type: :runtime
|
108
109
|
prerelease: false
|
109
110
|
version_requirements: !ruby/object:Gem::Requirement
|
110
111
|
requirements:
|
111
112
|
- - "~>"
|
112
113
|
- !ruby/object:Gem::Version
|
113
|
-
version: 0.
|
114
|
+
version: 0.25.0
|
114
115
|
- !ruby/object:Gem::Dependency
|
115
116
|
name: protocol-http1
|
116
117
|
requirement: !ruby/object:Gem::Requirement
|
117
118
|
requirements:
|
118
119
|
- - "~>"
|
119
120
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.
|
121
|
+
version: 0.16.0
|
121
122
|
type: :runtime
|
122
123
|
prerelease: false
|
123
124
|
version_requirements: !ruby/object:Gem::Requirement
|
124
125
|
requirements:
|
125
126
|
- - "~>"
|
126
127
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0.
|
128
|
+
version: 0.16.0
|
128
129
|
- !ruby/object:Gem::Dependency
|
129
130
|
name: protocol-http2
|
130
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,90 +154,6 @@ dependencies:
|
|
153
154
|
- - ">="
|
154
155
|
- !ruby/object:Gem::Version
|
155
156
|
version: 0.10.0
|
156
|
-
- !ruby/object:Gem::Dependency
|
157
|
-
name: async-container
|
158
|
-
requirement: !ruby/object:Gem::Requirement
|
159
|
-
requirements:
|
160
|
-
- - "~>"
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: '0.14'
|
163
|
-
type: :development
|
164
|
-
prerelease: false
|
165
|
-
version_requirements: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '0.14'
|
170
|
-
- !ruby/object:Gem::Dependency
|
171
|
-
name: async-rspec
|
172
|
-
requirement: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - "~>"
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: '1.10'
|
177
|
-
type: :development
|
178
|
-
prerelease: false
|
179
|
-
version_requirements: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - "~>"
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: '1.10'
|
184
|
-
- !ruby/object:Gem::Dependency
|
185
|
-
name: covered
|
186
|
-
requirement: !ruby/object:Gem::Requirement
|
187
|
-
requirements:
|
188
|
-
- - ">="
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version: '0'
|
191
|
-
type: :development
|
192
|
-
prerelease: false
|
193
|
-
version_requirements: !ruby/object:Gem::Requirement
|
194
|
-
requirements:
|
195
|
-
- - ">="
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: '0'
|
198
|
-
- !ruby/object:Gem::Dependency
|
199
|
-
name: localhost
|
200
|
-
requirement: !ruby/object:Gem::Requirement
|
201
|
-
requirements:
|
202
|
-
- - ">="
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: '0'
|
205
|
-
type: :development
|
206
|
-
prerelease: false
|
207
|
-
version_requirements: !ruby/object:Gem::Requirement
|
208
|
-
requirements:
|
209
|
-
- - ">="
|
210
|
-
- !ruby/object:Gem::Version
|
211
|
-
version: '0'
|
212
|
-
- !ruby/object:Gem::Dependency
|
213
|
-
name: rack-test
|
214
|
-
requirement: !ruby/object:Gem::Requirement
|
215
|
-
requirements:
|
216
|
-
- - ">="
|
217
|
-
- !ruby/object:Gem::Version
|
218
|
-
version: '0'
|
219
|
-
type: :development
|
220
|
-
prerelease: false
|
221
|
-
version_requirements: !ruby/object:Gem::Requirement
|
222
|
-
requirements:
|
223
|
-
- - ">="
|
224
|
-
- !ruby/object:Gem::Version
|
225
|
-
version: '0'
|
226
|
-
- !ruby/object:Gem::Dependency
|
227
|
-
name: rspec
|
228
|
-
requirement: !ruby/object:Gem::Requirement
|
229
|
-
requirements:
|
230
|
-
- - "~>"
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: '3.6'
|
233
|
-
type: :development
|
234
|
-
prerelease: false
|
235
|
-
version_requirements: !ruby/object:Gem::Requirement
|
236
|
-
requirements:
|
237
|
-
- - "~>"
|
238
|
-
- !ruby/object:Gem::Version
|
239
|
-
version: '3.6'
|
240
157
|
description:
|
241
158
|
email:
|
242
159
|
executables: []
|
@@ -297,14 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
297
214
|
requirements:
|
298
215
|
- - ">="
|
299
216
|
- !ruby/object:Gem::Version
|
300
|
-
version: '0'
|
217
|
+
version: '3.0'
|
301
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
219
|
requirements:
|
303
220
|
- - ">="
|
304
221
|
- !ruby/object:Gem::Version
|
305
222
|
version: '0'
|
306
223
|
requirements: []
|
307
|
-
rubygems_version: 3.4.
|
224
|
+
rubygems_version: 3.4.10
|
308
225
|
signing_key:
|
309
226
|
specification_version: 4
|
310
227
|
summary: A HTTP client and server library.
|
metadata.gz.sig
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
��e
|
1
|
+
����ߪ�Ek C֟���ob8ĕ�51��2Β�l��p�}�W}���i���l
|
2
|
+
ՇHI�<�Ӻ���� ����Jf>1N�̻Ԭ�� ��X��nR�G�X�{���â�4#��';�aύX�`=�3�#�O�"�<�i���_�}�'�&v�r��j�1sə�Պ�ɉt� CTr�59*�Y¿��t����j��R���a�ц���&�P� Ӱ�2}r��B@ADn^�#���/I������'�r05�0�Bޙ�h5��+�{KX��GY��`�#R�0�S6��:O�=W[(.\��_f�A���&*lRڮ��;k�U��
|
3
|
+
&���F&}i�C�]�E]��+J�~9mc�
|
4
|
+
��)e�t��fn}��B����x� ���¹
|