protocol-http2 0.17.0 → 0.19.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/protocol/http2/client.rb +2 -2
- data/lib/protocol/http2/connection.rb +15 -9
- data/lib/protocol/http2/continuation_frame.rb +2 -2
- data/lib/protocol/http2/data_frame.rb +3 -3
- data/lib/protocol/http2/error.rb +2 -2
- data/lib/protocol/http2/flow_controlled.rb +2 -2
- data/lib/protocol/http2/frame.rb +3 -3
- data/lib/protocol/http2/framer.rb +12 -12
- data/lib/protocol/http2/goaway_frame.rb +2 -2
- data/lib/protocol/http2/headers_frame.rb +5 -5
- data/lib/protocol/http2/padded.rb +2 -2
- data/lib/protocol/http2/ping_frame.rb +2 -2
- data/lib/protocol/http2/priority_frame.rb +2 -2
- data/lib/protocol/http2/push_promise_frame.rb +4 -4
- data/lib/protocol/http2/reset_stream_frame.rb +2 -2
- data/lib/protocol/http2/server.rb +2 -2
- data/lib/protocol/http2/settings_frame.rb +2 -2
- data/lib/protocol/http2/stream.rb +42 -46
- data/lib/protocol/http2/version.rb +2 -2
- data/lib/protocol/http2/window_update_frame.rb +2 -2
- data/lib/protocol/http2.rb +3 -3
- data/readme.md +3 -3
- data.tar.gz.sig +0 -0
- metadata +7 -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: 6fa9a1478ba8829d9e4416cd5507ca611d5e502eb242b1d873d44d1d60a40850
|
4
|
+
data.tar.gz: 4c560c928f9027108f5cf6b4fd135ce2a7043815cf8c4e2077fd5d20865e26be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95f413d65bbde12d848f7cbe342274d7e914aca16c1a60d2f3193b91e670ae0553233fe3ae1ef4699d87984c711311c7247daac0990bb44ab0f8d3aa44d4f604
|
7
|
+
data.tar.gz: 5abe10dc681f35b42a123e69b4fca512d8f0e43b5741d9ab4987c336efa508e6981f2370357fa384c22bbaed8ab5d7725257dc2816823b29926de2c2e7d68d6a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "connection"
|
7
7
|
|
8
8
|
module Protocol
|
9
9
|
module HTTP2
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2023, by Marco Concetto Rudilosso.
|
6
6
|
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
7
|
+
require_relative "framer"
|
8
|
+
require_relative "dependency"
|
9
|
+
require_relative "flow_controlled"
|
10
10
|
|
11
|
-
require
|
11
|
+
require "protocol/hpack"
|
12
12
|
|
13
13
|
module Protocol
|
14
14
|
module HTTP2
|
@@ -62,8 +62,9 @@ module Protocol
|
|
62
62
|
@remote_settings.maximum_frame_size
|
63
63
|
end
|
64
64
|
|
65
|
+
# The maximum number of concurrent streams that this connection can initiate:
|
65
66
|
def maximum_concurrent_streams
|
66
|
-
@
|
67
|
+
@remote_settings.maximum_concurrent_streams
|
67
68
|
end
|
68
69
|
|
69
70
|
attr :framer
|
@@ -214,16 +215,20 @@ module Protocol
|
|
214
215
|
def write_frame(frame)
|
215
216
|
synchronize do
|
216
217
|
@framer.write_frame(frame)
|
217
|
-
@framer.flush
|
218
218
|
end
|
219
|
+
|
220
|
+
# The IO is already synchronized, and we don't want additional contention.
|
221
|
+
@framer.flush
|
219
222
|
end
|
220
223
|
|
221
224
|
def write_frames
|
222
225
|
if @framer
|
223
226
|
synchronize do
|
224
227
|
yield @framer
|
225
|
-
@framer.flush
|
226
228
|
end
|
229
|
+
|
230
|
+
# See above note.
|
231
|
+
@framer.flush
|
227
232
|
else
|
228
233
|
raise EOFError, "Connection closed!"
|
229
234
|
end
|
@@ -385,7 +390,8 @@ module Protocol
|
|
385
390
|
raise ProtocolError, "Invalid stream id: #{stream_id} <= #{@remote_stream_id}!"
|
386
391
|
end
|
387
392
|
|
388
|
-
|
393
|
+
# We need to validate that we have less streams than the specified maximum:
|
394
|
+
if @streams.size < @local_settings.maximum_concurrent_streams
|
389
395
|
stream = accept_stream(stream_id)
|
390
396
|
@remote_stream_id = stream_id
|
391
397
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "frame"
|
7
|
+
require_relative "padded"
|
8
8
|
|
9
9
|
module Protocol
|
10
10
|
module HTTP2
|
data/lib/protocol/http2/error.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "protocol/http/error"
|
7
7
|
|
8
8
|
module Protocol
|
9
9
|
module HTTP2
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2019, by Yuta Iwama.
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "window_update_frame"
|
8
8
|
|
9
9
|
module Protocol
|
10
10
|
module HTTP2
|
data/lib/protocol/http2/frame.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2019, by Yuta Iwama.
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "error"
|
8
8
|
|
9
9
|
module Protocol
|
10
10
|
module HTTP2
|
@@ -106,7 +106,7 @@ module Protocol
|
|
106
106
|
@stream_id.zero?
|
107
107
|
end
|
108
108
|
|
109
|
-
HEADER_FORMAT =
|
109
|
+
HEADER_FORMAT = "CnCCN".freeze
|
110
110
|
STREAM_ID_MASK = 0x7fffffff
|
111
111
|
|
112
112
|
# Generates common 9-byte frame header.
|
@@ -1,20 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "error"
|
7
7
|
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
8
|
+
require_relative "data_frame"
|
9
|
+
require_relative "headers_frame"
|
10
|
+
require_relative "priority_frame"
|
11
|
+
require_relative "reset_stream_frame"
|
12
|
+
require_relative "settings_frame"
|
13
|
+
require_relative "push_promise_frame"
|
14
|
+
require_relative "ping_frame"
|
15
|
+
require_relative "goaway_frame"
|
16
|
+
require_relative "window_update_frame"
|
17
|
+
require_relative "continuation_frame"
|
18
18
|
|
19
19
|
module Protocol
|
20
20
|
module HTTP2
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
6
|
+
require_relative "frame"
|
7
|
+
require_relative "padded"
|
8
|
+
require_relative "continuation_frame"
|
9
|
+
require_relative "priority_frame"
|
10
10
|
|
11
11
|
module Protocol
|
12
12
|
module HTTP2
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
6
|
+
require_relative "frame"
|
7
|
+
require_relative "padded"
|
8
|
+
require_relative "continuation_frame"
|
9
9
|
|
10
10
|
module Protocol
|
11
11
|
module HTTP2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "connection"
|
7
7
|
|
8
8
|
module Protocol
|
9
9
|
module HTTP2
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "ping_frame"
|
7
7
|
|
8
8
|
module Protocol
|
9
9
|
module HTTP2
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "connection"
|
7
|
+
require_relative "dependency"
|
8
8
|
|
9
9
|
module Protocol
|
10
10
|
module HTTP2
|
11
|
-
# A single HTTP
|
11
|
+
# A single HTTP/2 connection can multiplex multiple streams in parallel:
|
12
12
|
# multiple requests and responses can be in flight simultaneously and stream
|
13
13
|
# data can be interleaved and prioritized.
|
14
14
|
#
|
@@ -18,42 +18,44 @@ module Protocol
|
|
18
18
|
# diagram below) and provide your application logic to handle request
|
19
19
|
# and response processing.
|
20
20
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
21
|
+
# ```
|
22
|
+
# ┌────────┐
|
23
|
+
# send PP │ │ recv PP
|
24
|
+
# ┌──────────┤ idle ├──────────┐
|
25
|
+
# │ │ │ │
|
26
|
+
# ▼ └───┬────┘ ▼
|
27
|
+
# ┌──────────┐ │ ┌──────────┐
|
28
|
+
# │ │ │ send H / │ │
|
29
|
+
# ┌──────┼ reserved │ │ recv H │ reserved ├──────┐
|
30
|
+
# │ │ (local) │ │ │ (remote) │ │
|
31
|
+
# │ └───┬──────┘ ▼ └──────┬───┘ │
|
32
|
+
# │ │ ┌────────┐ │ │
|
33
|
+
# │ │ recv ES │ │ send ES │ │
|
34
|
+
# │ send H │ ┌─────────┤ open ├─────────┐ │ recv H │
|
35
|
+
# │ │ │ │ │ │ │ │
|
36
|
+
# │ ▼ ▼ └───┬────┘ ▼ ▼ │
|
37
|
+
# │ ┌──────────┐ │ ┌──────────┐ │
|
38
|
+
# │ │ half │ │ │ half │ │
|
39
|
+
# │ │ closed │ │ send R / │ closed │ │
|
40
|
+
# │ │ (remote) │ │ recv R │ (local) │ │
|
41
|
+
# │ └────┬─────┘ │ └─────┬────┘ │
|
42
|
+
# │ │ │ │ │
|
43
|
+
# │ │ send ES / │ recv ES / │ │
|
44
|
+
# │ │ send R / ▼ send R / │ │
|
45
|
+
# │ │ recv R ┌────────┐ recv R │ │
|
46
|
+
# │ send R / └───────────►│ │◄───────────┘ send R / │
|
47
|
+
# │ recv R │ closed │ recv R │
|
48
|
+
# └───────────────────────►│ │◄───────────────────────┘
|
49
|
+
# └────────┘
|
50
|
+
# ```
|
51
|
+
#
|
52
|
+
# - `send`: endpoint sends this frame
|
53
|
+
# - `recv`: endpoint receives this frame
|
54
|
+
#
|
55
|
+
# - H: HEADERS frame (with implied CONTINUATIONs)
|
56
|
+
# - PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
|
57
|
+
# - ES: END_STREAM flag
|
58
|
+
# - R: RST_STREAM frame
|
57
59
|
#
|
58
60
|
# State transition methods use a trailing "!".
|
59
61
|
class Stream
|
@@ -219,10 +221,6 @@ module Protocol
|
|
219
221
|
end
|
220
222
|
end
|
221
223
|
|
222
|
-
# The stream has been opened.
|
223
|
-
def opened(error = nil)
|
224
|
-
end
|
225
|
-
|
226
224
|
def open!
|
227
225
|
if @state == :idle
|
228
226
|
@state = :open
|
@@ -230,8 +228,6 @@ module Protocol
|
|
230
228
|
raise ProtocolError, "Cannot open stream in state: #{@state}"
|
231
229
|
end
|
232
230
|
|
233
|
-
self.opened
|
234
|
-
|
235
231
|
return self
|
236
232
|
end
|
237
233
|
|
data/lib/protocol/http2.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "http2/version"
|
7
|
+
require_relative "http2/connection"
|
data/readme.md
CHANGED
@@ -99,8 +99,8 @@ We welcome contributions to this project.
|
|
99
99
|
|
100
100
|
### Developer Certificate of Origin
|
101
101
|
|
102
|
-
|
102
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
103
103
|
|
104
|
-
###
|
104
|
+
### Community Guidelines
|
105
105
|
|
106
|
-
This project is
|
106
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protocol-http2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -40,7 +40,7 @@ cert_chain:
|
|
40
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
41
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
42
42
|
-----END CERTIFICATE-----
|
43
|
-
date: 2024-
|
43
|
+
date: 2024-09-24 00:00:00.000000000 Z
|
44
44
|
dependencies:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: protocol-hpack
|
@@ -103,7 +103,9 @@ files:
|
|
103
103
|
homepage: https://github.com/socketry/protocol-http2
|
104
104
|
licenses:
|
105
105
|
- MIT
|
106
|
-
metadata:
|
106
|
+
metadata:
|
107
|
+
documentation_uri: https://socketry.github.io/protocol-http2/
|
108
|
+
source_code_uri: https://github.com/socketry/protocol-http2.git
|
107
109
|
post_install_message:
|
108
110
|
rdoc_options: []
|
109
111
|
require_paths:
|
@@ -112,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
114
|
requirements:
|
113
115
|
- - ">="
|
114
116
|
- !ruby/object:Gem::Version
|
115
|
-
version: '3.
|
117
|
+
version: '3.1'
|
116
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
119
|
requirements:
|
118
120
|
- - ">="
|
119
121
|
- !ruby/object:Gem::Version
|
120
122
|
version: '0'
|
121
123
|
requirements: []
|
122
|
-
rubygems_version: 3.5.
|
124
|
+
rubygems_version: 3.5.11
|
123
125
|
signing_key:
|
124
126
|
specification_version: 4
|
125
127
|
summary: A low level implementation of the HTTP/2 protocol.
|
metadata.gz.sig
CHANGED
Binary file
|