async-http 0.60.1 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/async/http/h2spec.rb +4 -0
- data/bake/async/http.rb +4 -0
- data/lib/async/http/body/delayed.rb +6 -21
- data/lib/async/http/body/hijack.rb +3 -20
- data/lib/async/http/body/pipe.rb +4 -20
- data/lib/async/http/body/slowloris.rb +3 -20
- data/lib/async/http/body/writable.rb +3 -20
- data/lib/async/http/body.rb +3 -20
- data/lib/async/http/client.rb +6 -22
- data/lib/async/http/endpoint.rb +8 -20
- data/lib/async/http/internet/instance.rb +3 -20
- data/lib/async/http/internet.rb +3 -20
- data/lib/async/http/protocol/http1/client.rb +3 -20
- data/lib/async/http/protocol/http1/connection.rb +3 -20
- data/lib/async/http/protocol/http1/request.rb +7 -20
- data/lib/async/http/protocol/http1/response.rb +15 -24
- data/lib/async/http/protocol/http1/server.rb +11 -22
- data/lib/async/http/protocol/http1.rb +3 -20
- data/lib/async/http/protocol/http10.rb +3 -20
- data/lib/async/http/protocol/http11.rb +4 -20
- data/lib/async/http/protocol/http2/client.rb +3 -20
- data/lib/async/http/protocol/http2/connection.rb +4 -20
- data/lib/async/http/protocol/http2/input.rb +3 -20
- data/lib/async/http/protocol/http2/output.rb +3 -20
- data/lib/async/http/protocol/http2/request.rb +13 -20
- data/lib/async/http/protocol/http2/response.rb +9 -20
- data/lib/async/http/protocol/http2/server.rb +3 -20
- data/lib/async/http/protocol/http2/stream.rb +8 -26
- data/lib/async/http/protocol/http2.rb +3 -20
- data/lib/async/http/protocol/https.rb +4 -20
- data/lib/async/http/protocol/request.rb +6 -20
- data/lib/async/http/protocol/response.rb +3 -20
- data/lib/async/http/protocol.rb +3 -20
- data/lib/async/http/proxy.rb +3 -20
- data/lib/async/http/reference.rb +3 -20
- data/lib/async/http/relative_location.rb +5 -19
- data/lib/async/http/server.rb +6 -22
- data/lib/async/http/statistics.rb +3 -20
- data/lib/async/http/version.rb +4 -21
- data/lib/async/http.rb +3 -20
- data/license.md +38 -0
- data/readme.md +384 -0
- data.tar.gz.sig +0 -0
- metadata +16 -96
- metadata.gz.sig +0 -0
data/lib/async/http/version.rb
CHANGED
@@ -1,27 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2017-2023, by Samuel Williams.
|
22
5
|
|
23
6
|
module Async
|
24
7
|
module HTTP
|
25
|
-
VERSION = "0.
|
8
|
+
VERSION = "0.61.0"
|
26
9
|
end
|
27
10
|
end
|
data/lib/async/http.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2017-2023, by Samuel Williams.
|
22
5
|
|
23
6
|
require_relative 'http/version'
|
24
7
|
|
data/license.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2017-2023, by Samuel Williams.
|
4
|
+
Copyright, 2018, by Viacheslav Koval.
|
5
|
+
Copyright, 2018, by Janko Marohnić.
|
6
|
+
Copyright, 2019, by Denis Talakevich.
|
7
|
+
Copyright, 2019-2020, by Brian Morearty.
|
8
|
+
Copyright, 2019, by Cyril Roelandt.
|
9
|
+
Copyright, 2020, by Stefan Wrobel.
|
10
|
+
Copyright, 2020, by Igor Sidorov.
|
11
|
+
Copyright, 2020, by Bruno Sutic.
|
12
|
+
Copyright, 2020, by Sam Shadwell.
|
13
|
+
Copyright, 2020, by Orgad Shaneh.
|
14
|
+
Copyright, 2021, by Trevor Turk.
|
15
|
+
Copyright, 2021, by Olle Jonsson.
|
16
|
+
Copyright, 2021-2022, by Adam Daniels.
|
17
|
+
Copyright, 2022, by Ian Ker-Seymer.
|
18
|
+
Copyright, 2022, by Marco Concetto Rudilosso.
|
19
|
+
Copyright, 2022, by Tim Meusel.
|
20
|
+
Copyright, 2023, by Thomas Morgan.
|
21
|
+
|
22
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
23
|
+
of this software and associated documentation files (the "Software"), to deal
|
24
|
+
in the Software without restriction, including without limitation the rights
|
25
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
26
|
+
copies of the Software, and to permit persons to whom the Software is
|
27
|
+
furnished to do so, subject to the following conditions:
|
28
|
+
|
29
|
+
The above copyright notice and this permission notice shall be included in all
|
30
|
+
copies or substantial portions of the Software.
|
31
|
+
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
33
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
35
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
36
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
37
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
38
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,384 @@
|
|
1
|
+
# Async::HTTP
|
2
|
+
|
3
|
+
An asynchronous client and server implementation of HTTP/1.0, HTTP/1.1 and HTTP/2 including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async) and [async-io](https://github.com/socketry/async-io). [falcon](https://github.com/socketry/falcon) provides a rack-compatible server.
|
4
|
+
|
5
|
+
[](https://github.com/socketry/async-http/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
``` ruby
|
12
|
+
gem 'async-http'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install async-http
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Please see the [project documentation](https://socketry.github.io/async-http/) or serve it locally using `bake utopia:project:serve`.
|
26
|
+
|
27
|
+
### Post JSON data
|
28
|
+
|
29
|
+
Here is an example showing how to post a data structure as JSON to a remote resource:
|
30
|
+
|
31
|
+
``` ruby
|
32
|
+
#!/usr/bin/env ruby
|
33
|
+
|
34
|
+
require 'json'
|
35
|
+
require 'async'
|
36
|
+
require 'async/http/internet'
|
37
|
+
|
38
|
+
data = {'life' => 42}
|
39
|
+
|
40
|
+
Async do
|
41
|
+
# Make a new internet:
|
42
|
+
internet = Async::HTTP::Internet.new
|
43
|
+
|
44
|
+
# Prepare the request:
|
45
|
+
headers = [['accept', 'application/json']]
|
46
|
+
body = [JSON.dump(data)]
|
47
|
+
|
48
|
+
# Issues a POST request:
|
49
|
+
response = internet.post("https://httpbin.org/anything", headers, body)
|
50
|
+
|
51
|
+
# Save the response body to a local file:
|
52
|
+
pp JSON.parse(response.read)
|
53
|
+
ensure
|
54
|
+
# The internet is closed for business:
|
55
|
+
internet.close
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
Consider using [async-rest](https://github.com/socketry/async-rest) instead.
|
60
|
+
|
61
|
+
### Multiple Requests
|
62
|
+
|
63
|
+
To issue multiple requests concurrently, you should use a barrier, e.g.
|
64
|
+
|
65
|
+
``` ruby
|
66
|
+
#!/usr/bin/env ruby
|
67
|
+
|
68
|
+
require 'async'
|
69
|
+
require 'async/barrier'
|
70
|
+
require 'async/http/internet'
|
71
|
+
|
72
|
+
TOPICS = ["ruby", "python", "rust"]
|
73
|
+
|
74
|
+
Async do
|
75
|
+
internet = Async::HTTP::Internet.new
|
76
|
+
barrier = Async::Barrier.new
|
77
|
+
|
78
|
+
# Spawn an asynchronous task for each topic:
|
79
|
+
TOPICS.each do |topic|
|
80
|
+
barrier.async do
|
81
|
+
response = internet.get "https://www.google.com/search?q=#{topic}"
|
82
|
+
puts "Found #{topic}: #{response.read.scan(topic).size} times."
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Ensure we wait for all requests to complete before continuing:
|
87
|
+
barrier.wait
|
88
|
+
ensure
|
89
|
+
internet&.close
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
#### Limiting Requests
|
94
|
+
|
95
|
+
If you need to limit the number of simultaneous requests, use a semaphore.
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
#!/usr/bin/env ruby
|
99
|
+
|
100
|
+
require 'async'
|
101
|
+
require 'async/barrier'
|
102
|
+
require 'async/semaphore'
|
103
|
+
require 'async/http/internet'
|
104
|
+
|
105
|
+
TOPICS = ["ruby", "python", "rust"]
|
106
|
+
|
107
|
+
Async do
|
108
|
+
internet = Async::HTTP::Internet.new
|
109
|
+
barrier = Async::Barrier.new
|
110
|
+
semaphore = Async::Semaphore.new(2, parent: barrier)
|
111
|
+
|
112
|
+
# Spawn an asynchronous task for each topic:
|
113
|
+
TOPICS.each do |topic|
|
114
|
+
semaphore.async do
|
115
|
+
response = internet.get "https://www.google.com/search?q=#{topic}"
|
116
|
+
puts "Found #{topic}: #{response.read.scan(topic).size} times."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Ensure we wait for all requests to complete before continuing:
|
121
|
+
barrier.wait
|
122
|
+
ensure
|
123
|
+
internet&.close
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
### Persistent Connections
|
128
|
+
|
129
|
+
To keep connections alive, install the `thread-local` gem,
|
130
|
+
require `async/http/internet/instance`, and use the `instance`, e.g.
|
131
|
+
|
132
|
+
``` ruby
|
133
|
+
#!/usr/bin/env ruby
|
134
|
+
|
135
|
+
require 'async'
|
136
|
+
require 'async/http/internet/instance'
|
137
|
+
|
138
|
+
Async do
|
139
|
+
internet = Async::HTTP::Internet.instance
|
140
|
+
response = internet.get "https://www.google.com/search?q=test"
|
141
|
+
puts "Found #{response.read.size} results."
|
142
|
+
end
|
143
|
+
```
|
144
|
+
|
145
|
+
### Downloading a File
|
146
|
+
|
147
|
+
Here is an example showing how to download a file and save it to a local path:
|
148
|
+
|
149
|
+
``` ruby
|
150
|
+
#!/usr/bin/env ruby
|
151
|
+
|
152
|
+
require 'async'
|
153
|
+
require 'async/http/internet'
|
154
|
+
|
155
|
+
Async do
|
156
|
+
# Make a new internet:
|
157
|
+
internet = Async::HTTP::Internet.new
|
158
|
+
|
159
|
+
# Issues a GET request to Google:
|
160
|
+
response = internet.get("https://www.google.com/search?q=kittens")
|
161
|
+
|
162
|
+
# Save the response body to a local file:
|
163
|
+
response.save("/tmp/search.html")
|
164
|
+
ensure
|
165
|
+
# The internet is closed for business:
|
166
|
+
internet.close
|
167
|
+
end
|
168
|
+
```
|
169
|
+
|
170
|
+
### Basic Client/Server
|
171
|
+
|
172
|
+
Here is a basic example of a client/server running in the same reactor:
|
173
|
+
|
174
|
+
``` ruby
|
175
|
+
#!/usr/bin/env ruby
|
176
|
+
|
177
|
+
require 'async'
|
178
|
+
require 'async/http/server'
|
179
|
+
require 'async/http/client'
|
180
|
+
require 'async/http/endpoint'
|
181
|
+
require 'async/http/protocol/response'
|
182
|
+
|
183
|
+
endpoint = Async::HTTP::Endpoint.parse('http://127.0.0.1:9294')
|
184
|
+
|
185
|
+
app = lambda do |request|
|
186
|
+
Protocol::HTTP::Response[200, {}, ["Hello World"]]
|
187
|
+
end
|
188
|
+
|
189
|
+
server = Async::HTTP::Server.new(app, endpoint)
|
190
|
+
client = Async::HTTP::Client.new(endpoint)
|
191
|
+
|
192
|
+
Async do |task|
|
193
|
+
server_task = task.async do
|
194
|
+
server.run
|
195
|
+
end
|
196
|
+
|
197
|
+
response = client.get("/")
|
198
|
+
|
199
|
+
puts response.status
|
200
|
+
puts response.read
|
201
|
+
|
202
|
+
server_task.stop
|
203
|
+
end
|
204
|
+
```
|
205
|
+
|
206
|
+
### Advanced Verification
|
207
|
+
|
208
|
+
You can hook into SSL certificate verification to improve server verification.
|
209
|
+
|
210
|
+
``` ruby
|
211
|
+
require 'async'
|
212
|
+
require 'async/http'
|
213
|
+
|
214
|
+
# These are generated from the certificate chain that the server presented.
|
215
|
+
trusted_fingerprints = {
|
216
|
+
"dac9024f54d8f6df94935fb1732638ca6ad77c13" => true,
|
217
|
+
"e6a3b45b062d509b3382282d196efe97d5956ccb" => true,
|
218
|
+
"07d63f4c05a03f1c306f9941b8ebf57598719ea2" => true,
|
219
|
+
"e8d994f44ff20dc78dbff4e59d7da93900572bbf" => true,
|
220
|
+
}
|
221
|
+
|
222
|
+
Async do
|
223
|
+
endpoint = Async::HTTP::Endpoint.parse("https://www.codeotaku.com/index")
|
224
|
+
|
225
|
+
# This is a quick hack/POC:
|
226
|
+
ssl_context = endpoint.ssl_context
|
227
|
+
|
228
|
+
ssl_context.verify_callback = proc do |verified, store_context|
|
229
|
+
certificate = store_context.current_cert
|
230
|
+
fingerprint = OpenSSL::Digest::SHA1.new(certificate.to_der).to_s
|
231
|
+
|
232
|
+
if trusted_fingerprints.include? fingerprint
|
233
|
+
true
|
234
|
+
else
|
235
|
+
Console.logger.warn("Untrusted Certificate Fingerprint"){fingerprint}
|
236
|
+
false
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
endpoint = endpoint.with(ssl_context: ssl_context)
|
241
|
+
|
242
|
+
client = Async::HTTP::Client.new(endpoint)
|
243
|
+
|
244
|
+
response = client.get(endpoint.path)
|
245
|
+
|
246
|
+
pp response.status, response.headers.fields, response.read
|
247
|
+
end
|
248
|
+
```
|
249
|
+
|
250
|
+
### Timeouts
|
251
|
+
|
252
|
+
Here's a basic example with a timeout:
|
253
|
+
|
254
|
+
``` ruby
|
255
|
+
#!/usr/bin/env ruby
|
256
|
+
|
257
|
+
require 'async/http/internet'
|
258
|
+
|
259
|
+
Async do |task|
|
260
|
+
internet = Async::HTTP::Internet.new
|
261
|
+
|
262
|
+
# Request will timeout after 2 seconds
|
263
|
+
task.with_timeout(2) do
|
264
|
+
response = internet.get "https://httpbin.org/delay/10"
|
265
|
+
end
|
266
|
+
rescue Async::TimeoutError
|
267
|
+
puts "The request timed out"
|
268
|
+
ensure
|
269
|
+
internet&.close
|
270
|
+
end
|
271
|
+
```
|
272
|
+
|
273
|
+
## Performance
|
274
|
+
|
275
|
+
On a 4-core 8-thread i7, running `ab` which uses discrete (non-keep-alive) connections:
|
276
|
+
|
277
|
+
$ ab -c 8 -t 10 http://127.0.0.1:9294/
|
278
|
+
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
|
279
|
+
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
|
280
|
+
Licensed to The Apache Software Foundation, http://www.apache.org/
|
281
|
+
|
282
|
+
Benchmarking 127.0.0.1 (be patient)
|
283
|
+
Completed 5000 requests
|
284
|
+
Completed 10000 requests
|
285
|
+
Completed 15000 requests
|
286
|
+
Completed 20000 requests
|
287
|
+
Completed 25000 requests
|
288
|
+
Completed 30000 requests
|
289
|
+
Completed 35000 requests
|
290
|
+
Completed 40000 requests
|
291
|
+
Completed 45000 requests
|
292
|
+
Completed 50000 requests
|
293
|
+
Finished 50000 requests
|
294
|
+
|
295
|
+
|
296
|
+
Server Software:
|
297
|
+
Server Hostname: 127.0.0.1
|
298
|
+
Server Port: 9294
|
299
|
+
|
300
|
+
Document Path: /
|
301
|
+
Document Length: 13 bytes
|
302
|
+
|
303
|
+
Concurrency Level: 8
|
304
|
+
Time taken for tests: 1.869 seconds
|
305
|
+
Complete requests: 50000
|
306
|
+
Failed requests: 0
|
307
|
+
Total transferred: 2450000 bytes
|
308
|
+
HTML transferred: 650000 bytes
|
309
|
+
Requests per second: 26755.55 [#/sec] (mean)
|
310
|
+
Time per request: 0.299 [ms] (mean)
|
311
|
+
Time per request: 0.037 [ms] (mean, across all concurrent requests)
|
312
|
+
Transfer rate: 1280.29 [Kbytes/sec] received
|
313
|
+
|
314
|
+
Connection Times (ms)
|
315
|
+
min mean[+/-sd] median max
|
316
|
+
Connect: 0 0 0.0 0 0
|
317
|
+
Processing: 0 0 0.2 0 6
|
318
|
+
Waiting: 0 0 0.2 0 6
|
319
|
+
Total: 0 0 0.2 0 6
|
320
|
+
|
321
|
+
Percentage of the requests served within a certain time (ms)
|
322
|
+
50% 0
|
323
|
+
66% 0
|
324
|
+
75% 0
|
325
|
+
80% 0
|
326
|
+
90% 0
|
327
|
+
95% 1
|
328
|
+
98% 1
|
329
|
+
99% 1
|
330
|
+
100% 6 (longest request)
|
331
|
+
|
332
|
+
On a 4-core 8-thread i7, running `wrk`, which uses 8 keep-alive connections:
|
333
|
+
|
334
|
+
$ wrk -c 8 -d 10 -t 8 http://127.0.0.1:9294/
|
335
|
+
Running 10s test @ http://127.0.0.1:9294/
|
336
|
+
8 threads and 8 connections
|
337
|
+
Thread Stats Avg Stdev Max +/- Stdev
|
338
|
+
Latency 217.69us 0.99ms 23.21ms 97.39%
|
339
|
+
Req/Sec 12.18k 1.58k 17.67k 83.21%
|
340
|
+
974480 requests in 10.10s, 60.41MB read
|
341
|
+
Requests/sec: 96485.00
|
342
|
+
Transfer/sec: 5.98MB
|
343
|
+
|
344
|
+
According to these results, the cost of handling connections is quite high, while general throughput seems pretty decent.
|
345
|
+
|
346
|
+
## Semantic Model
|
347
|
+
|
348
|
+
### Scheme
|
349
|
+
|
350
|
+
HTTP/1 has an implicit scheme determined by the kind of connection made to the server (either `http` or `https`), while HTTP/2 models this explicitly and the client indicates this in the request using the `:scheme` pseudo-header (typically `https`). To normalize this, `Async::HTTP::Client` and `Async::HTTP::Server` have a default scheme which is used if none is supplied.
|
351
|
+
|
352
|
+
### Version
|
353
|
+
|
354
|
+
HTTP/1 has an explicit version while HTTP/2 does not expose the version in any way.
|
355
|
+
|
356
|
+
### Reason
|
357
|
+
|
358
|
+
HTTP/1 responses contain a reason field which is largely irrelevant. HTTP/2 does not support this field.
|
359
|
+
|
360
|
+
## Contributing
|
361
|
+
|
362
|
+
We welcome contributions to this project.
|
363
|
+
|
364
|
+
1. Fork it.
|
365
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
366
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
367
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
368
|
+
5. Create new Pull Request.
|
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
|
+
|
378
|
+
## See Also
|
379
|
+
|
380
|
+
- [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
|
381
|
+
- [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`.
|
382
|
+
- [async-websocket](https://github.com/socketry/async-websocket) — Asynchronous client and server websockets.
|
383
|
+
- [async-rest](https://github.com/socketry/async-rest) — A RESTful resource layer built on top of `async-http`.
|
384
|
+
- [async-http-faraday](https://github.com/socketry/async-http-faraday) — A faraday adapter to use `async-http`.
|
data.tar.gz.sig
CHANGED
Binary file
|
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
|
@@ -16,10 +17,11 @@ authors:
|
|
16
17
|
- Marco Concetto Rudilosso
|
17
18
|
- Olle Jonsson
|
18
19
|
- Orgad Shaneh
|
20
|
+
- Sam Shadwell
|
19
21
|
- Stefan Wrobel
|
20
|
-
-
|
22
|
+
- Tim Meusel
|
21
23
|
- Trevor Turk
|
22
|
-
-
|
24
|
+
- Viacheslav Koval
|
23
25
|
autorequire:
|
24
26
|
bindir: bin
|
25
27
|
cert_chain:
|
@@ -52,7 +54,7 @@ cert_chain:
|
|
52
54
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
53
55
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
54
56
|
-----END CERTIFICATE-----
|
55
|
-
date: 2023-
|
57
|
+
date: 2023-10-24 00:00:00.000000000 Z
|
56
58
|
dependencies:
|
57
59
|
- !ruby/object:Gem::Dependency
|
58
60
|
name: async
|
@@ -102,28 +104,28 @@ dependencies:
|
|
102
104
|
requirements:
|
103
105
|
- - "~>"
|
104
106
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
107
|
+
version: 0.25.0
|
106
108
|
type: :runtime
|
107
109
|
prerelease: false
|
108
110
|
version_requirements: !ruby/object:Gem::Requirement
|
109
111
|
requirements:
|
110
112
|
- - "~>"
|
111
113
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.
|
114
|
+
version: 0.25.0
|
113
115
|
- !ruby/object:Gem::Dependency
|
114
116
|
name: protocol-http1
|
115
117
|
requirement: !ruby/object:Gem::Requirement
|
116
118
|
requirements:
|
117
119
|
- - "~>"
|
118
120
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.
|
121
|
+
version: 0.16.0
|
120
122
|
type: :runtime
|
121
123
|
prerelease: false
|
122
124
|
version_requirements: !ruby/object:Gem::Requirement
|
123
125
|
requirements:
|
124
126
|
- - "~>"
|
125
127
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.
|
128
|
+
version: 0.16.0
|
127
129
|
- !ruby/object:Gem::Dependency
|
128
130
|
name: protocol-http2
|
129
131
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,98 +146,14 @@ dependencies:
|
|
144
146
|
requirements:
|
145
147
|
- - ">="
|
146
148
|
- !ruby/object:Gem::Version
|
147
|
-
version: 0.
|
149
|
+
version: 0.10.0
|
148
150
|
type: :runtime
|
149
151
|
prerelease: false
|
150
152
|
version_requirements: !ruby/object:Gem::Requirement
|
151
153
|
requirements:
|
152
154
|
- - ">="
|
153
155
|
- !ruby/object:Gem::Version
|
154
|
-
version: 0.
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
name: async-container
|
157
|
-
requirement: !ruby/object:Gem::Requirement
|
158
|
-
requirements:
|
159
|
-
- - "~>"
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
version: '0.14'
|
162
|
-
type: :development
|
163
|
-
prerelease: false
|
164
|
-
version_requirements: !ruby/object:Gem::Requirement
|
165
|
-
requirements:
|
166
|
-
- - "~>"
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '0.14'
|
169
|
-
- !ruby/object:Gem::Dependency
|
170
|
-
name: async-rspec
|
171
|
-
requirement: !ruby/object:Gem::Requirement
|
172
|
-
requirements:
|
173
|
-
- - "~>"
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
version: '1.10'
|
176
|
-
type: :development
|
177
|
-
prerelease: false
|
178
|
-
version_requirements: !ruby/object:Gem::Requirement
|
179
|
-
requirements:
|
180
|
-
- - "~>"
|
181
|
-
- !ruby/object:Gem::Version
|
182
|
-
version: '1.10'
|
183
|
-
- !ruby/object:Gem::Dependency
|
184
|
-
name: covered
|
185
|
-
requirement: !ruby/object:Gem::Requirement
|
186
|
-
requirements:
|
187
|
-
- - ">="
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
190
|
-
type: :development
|
191
|
-
prerelease: false
|
192
|
-
version_requirements: !ruby/object:Gem::Requirement
|
193
|
-
requirements:
|
194
|
-
- - ">="
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
version: '0'
|
197
|
-
- !ruby/object:Gem::Dependency
|
198
|
-
name: localhost
|
199
|
-
requirement: !ruby/object:Gem::Requirement
|
200
|
-
requirements:
|
201
|
-
- - ">="
|
202
|
-
- !ruby/object:Gem::Version
|
203
|
-
version: '0'
|
204
|
-
type: :development
|
205
|
-
prerelease: false
|
206
|
-
version_requirements: !ruby/object:Gem::Requirement
|
207
|
-
requirements:
|
208
|
-
- - ">="
|
209
|
-
- !ruby/object:Gem::Version
|
210
|
-
version: '0'
|
211
|
-
- !ruby/object:Gem::Dependency
|
212
|
-
name: rack-test
|
213
|
-
requirement: !ruby/object:Gem::Requirement
|
214
|
-
requirements:
|
215
|
-
- - ">="
|
216
|
-
- !ruby/object:Gem::Version
|
217
|
-
version: '0'
|
218
|
-
type: :development
|
219
|
-
prerelease: false
|
220
|
-
version_requirements: !ruby/object:Gem::Requirement
|
221
|
-
requirements:
|
222
|
-
- - ">="
|
223
|
-
- !ruby/object:Gem::Version
|
224
|
-
version: '0'
|
225
|
-
- !ruby/object:Gem::Dependency
|
226
|
-
name: rspec
|
227
|
-
requirement: !ruby/object:Gem::Requirement
|
228
|
-
requirements:
|
229
|
-
- - "~>"
|
230
|
-
- !ruby/object:Gem::Version
|
231
|
-
version: '3.6'
|
232
|
-
type: :development
|
233
|
-
prerelease: false
|
234
|
-
version_requirements: !ruby/object:Gem::Requirement
|
235
|
-
requirements:
|
236
|
-
- - "~>"
|
237
|
-
- !ruby/object:Gem::Version
|
238
|
-
version: '3.6'
|
156
|
+
version: 0.10.0
|
239
157
|
description:
|
240
158
|
email:
|
241
159
|
executables: []
|
@@ -282,6 +200,8 @@ files:
|
|
282
200
|
- lib/async/http/server.rb
|
283
201
|
- lib/async/http/statistics.rb
|
284
202
|
- lib/async/http/version.rb
|
203
|
+
- license.md
|
204
|
+
- readme.md
|
285
205
|
homepage: https://github.com/socketry/async-http
|
286
206
|
licenses:
|
287
207
|
- MIT
|
@@ -294,14 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
294
214
|
requirements:
|
295
215
|
- - ">="
|
296
216
|
- !ruby/object:Gem::Version
|
297
|
-
version: '0'
|
217
|
+
version: '3.0'
|
298
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
299
219
|
requirements:
|
300
220
|
- - ">="
|
301
221
|
- !ruby/object:Gem::Version
|
302
222
|
version: '0'
|
303
223
|
requirements: []
|
304
|
-
rubygems_version: 3.4.
|
224
|
+
rubygems_version: 3.4.10
|
305
225
|
signing_key:
|
306
226
|
specification_version: 4
|
307
227
|
summary: A HTTP client and server library.
|
metadata.gz.sig
CHANGED
Binary file
|