async-http 0.66.3 → 0.67.1
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/lib/async/http/endpoint.rb +2 -2
- data/lib/async/http/protocol/http.rb +55 -0
- data/lib/async/http/protocol/http1.rb +4 -3
- data/lib/async/http/protocol/http10.rb +3 -2
- data/lib/async/http/protocol/http11.rb +3 -2
- data/lib/async/http/protocol/http2.rb +4 -3
- data/lib/async/http/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +6 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fa32fbabfbf7e98484c197db5062ecbdd5fc7f2e360fbdb778781ab64c2d18
|
4
|
+
data.tar.gz: 7212090a7708522c11dfa457e85714eb698493fc3382372f48b22cde748f1350
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aa817a134d29db249a8c503ac9fc69ffb8ed500e1518249f09f1fb4fe9d123e3682ec032d7e87368007ebcce56cf42861bd56be2e418d23d86565672d7a5017
|
7
|
+
data.tar.gz: 71e89c429dbdc4731c6e4335d14a235946fd1fecbbdc2deeed0ec0ef332f7952a5d175de63009a91b4cc35544b3ee8b3e915c6586df5fbea9a78253a4c5f5e19
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/async/http/endpoint.rb
CHANGED
@@ -8,7 +8,7 @@ require 'io/endpoint'
|
|
8
8
|
require 'io/endpoint/host_endpoint'
|
9
9
|
require 'io/endpoint/ssl_endpoint'
|
10
10
|
|
11
|
-
require_relative 'protocol/
|
11
|
+
require_relative 'protocol/http'
|
12
12
|
require_relative 'protocol/https'
|
13
13
|
|
14
14
|
module Async
|
@@ -84,7 +84,7 @@ module Async
|
|
84
84
|
if secure?
|
85
85
|
Protocol::HTTPS
|
86
86
|
else
|
87
|
-
Protocol::
|
87
|
+
Protocol::HTTP
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2023, by Thomas Morgan.
|
5
|
+
|
6
|
+
require_relative 'http1'
|
7
|
+
require_relative 'http2'
|
8
|
+
|
9
|
+
module Async
|
10
|
+
module HTTP
|
11
|
+
module Protocol
|
12
|
+
# HTTP is an http:// server that auto-selects HTTP/1.1 or HTTP/2 by detecting the HTTP/2
|
13
|
+
# connection preface.
|
14
|
+
module HTTP
|
15
|
+
HTTP2_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
|
16
|
+
HTTP2_PREFACE_SIZE = HTTP2_PREFACE.bytesize
|
17
|
+
|
18
|
+
def self.protocol_for(stream)
|
19
|
+
# Detect HTTP/2 connection preface
|
20
|
+
# https://www.rfc-editor.org/rfc/rfc9113.html#section-3.4
|
21
|
+
preface = stream.peek do |read_buffer|
|
22
|
+
if read_buffer.bytesize >= HTTP2_PREFACE_SIZE
|
23
|
+
break read_buffer[0, HTTP2_PREFACE_SIZE]
|
24
|
+
elsif read_buffer.bytesize > 0
|
25
|
+
# If partial read_buffer already doesn't match, no need to wait for more bytes.
|
26
|
+
break read_buffer unless HTTP2_PREFACE[read_buffer]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if preface == HTTP2_PREFACE
|
31
|
+
HTTP2
|
32
|
+
else
|
33
|
+
HTTP1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Only inbound connections can detect HTTP1 vs HTTP2 for http://.
|
38
|
+
# Outbound connections default to HTTP1.
|
39
|
+
def self.client(peer, **options)
|
40
|
+
HTTP1.client(peer, **options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.server(peer, **options)
|
44
|
+
stream = ::IO::Stream(peer)
|
45
|
+
|
46
|
+
return protocol_for(stream).server(stream, **options)
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.names
|
50
|
+
["h2", "http/1.1", "http/1.0"]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2017-2024, by Samuel Williams.
|
5
|
+
# Copyright, 2023, by Thomas Morgan.
|
5
6
|
|
6
7
|
require_relative 'http1/client'
|
7
8
|
require_relative 'http1/server'
|
8
9
|
|
9
|
-
require 'io/stream
|
10
|
+
require 'io/stream'
|
10
11
|
|
11
12
|
module Async
|
12
13
|
module HTTP
|
@@ -23,13 +24,13 @@ module Async
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.client(peer)
|
26
|
-
stream = ::IO::Stream
|
27
|
+
stream = ::IO::Stream(peer)
|
27
28
|
|
28
29
|
return HTTP1::Client.new(stream, VERSION)
|
29
30
|
end
|
30
31
|
|
31
32
|
def self.server(peer)
|
32
|
-
stream = ::IO::Stream
|
33
|
+
stream = ::IO::Stream(peer)
|
33
34
|
|
34
35
|
return HTTP1::Server.new(stream, VERSION)
|
35
36
|
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2017-2024, by Samuel Williams.
|
5
|
+
# Copyright, 2023, by Thomas Morgan.
|
5
6
|
|
6
7
|
require_relative 'http1'
|
7
8
|
|
@@ -20,13 +21,13 @@ module Async
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def self.client(peer)
|
23
|
-
stream = ::IO::Stream
|
24
|
+
stream = ::IO::Stream(peer)
|
24
25
|
|
25
26
|
return HTTP1::Client.new(stream, VERSION)
|
26
27
|
end
|
27
28
|
|
28
29
|
def self.server(peer)
|
29
|
-
stream = ::IO::Stream
|
30
|
+
stream = ::IO::Stream(peer)
|
30
31
|
|
31
32
|
return HTTP1::Server.new(stream, VERSION)
|
32
33
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2017-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2018, by Janko Marohnić.
|
6
|
+
# Copyright, 2023, by Thomas Morgan.
|
6
7
|
|
7
8
|
require_relative 'http1'
|
8
9
|
|
@@ -21,13 +22,13 @@ module Async
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.client(peer)
|
24
|
-
stream = ::IO::Stream
|
25
|
+
stream = ::IO::Stream(peer)
|
25
26
|
|
26
27
|
return HTTP1::Client.new(stream, VERSION)
|
27
28
|
end
|
28
29
|
|
29
30
|
def self.server(peer)
|
30
|
-
stream = ::IO::Stream
|
31
|
+
stream = ::IO::Stream(peer)
|
31
32
|
|
32
33
|
return HTTP1::Server.new(stream, VERSION)
|
33
34
|
end
|
@@ -2,11 +2,12 @@
|
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
|
+
# Copyright, 2023, by Thomas Morgan.
|
5
6
|
|
6
7
|
require_relative 'http2/client'
|
7
8
|
require_relative 'http2/server'
|
8
9
|
|
9
|
-
require 'io/stream
|
10
|
+
require 'io/stream'
|
10
11
|
|
11
12
|
module Async
|
12
13
|
module HTTP
|
@@ -37,7 +38,7 @@ module Async
|
|
37
38
|
}
|
38
39
|
|
39
40
|
def self.client(peer, settings = CLIENT_SETTINGS)
|
40
|
-
stream = ::IO::Stream
|
41
|
+
stream = ::IO::Stream(peer)
|
41
42
|
client = Client.new(stream)
|
42
43
|
|
43
44
|
client.send_connection_preface(settings)
|
@@ -47,7 +48,7 @@ module Async
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def self.server(peer, settings = SERVER_SETTINGS)
|
50
|
-
stream = ::IO::Stream
|
51
|
+
stream = ::IO::Stream(peer)
|
51
52
|
server = Server.new(stream)
|
52
53
|
|
53
54
|
server.read_connection_preface(settings)
|
data/lib/async/http/version.rb
CHANGED
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.67.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -57,7 +57,7 @@ cert_chain:
|
|
57
57
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
58
58
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
59
59
|
-----END CERTIFICATE-----
|
60
|
-
date: 2024-
|
60
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
61
61
|
dependencies:
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: async
|
@@ -155,14 +155,14 @@ dependencies:
|
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.
|
158
|
+
version: 0.18.0
|
159
159
|
type: :runtime
|
160
160
|
prerelease: false
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: 0.
|
165
|
+
version: 0.18.0
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
167
|
name: traces
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/async/http/internet.rb
|
198
198
|
- lib/async/http/internet/instance.rb
|
199
199
|
- lib/async/http/protocol.rb
|
200
|
+
- lib/async/http/protocol/http.rb
|
200
201
|
- lib/async/http/protocol/http1.rb
|
201
202
|
- lib/async/http/protocol/http1/client.rb
|
202
203
|
- lib/async/http/protocol/http1/connection.rb
|
@@ -246,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
247
|
- !ruby/object:Gem::Version
|
247
248
|
version: '0'
|
248
249
|
requirements: []
|
249
|
-
rubygems_version: 3.5.
|
250
|
+
rubygems_version: 3.5.9
|
250
251
|
signing_key:
|
251
252
|
specification_version: 4
|
252
253
|
summary: A HTTP client and server library.
|
metadata.gz.sig
CHANGED
Binary file
|