protocol-http2 0.18.0 → 0.19.1
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 +10 -10
- 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 +11 -11
- 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 +1 -1
- data/lib/protocol/http2/settings_frame.rb +2 -2
- data/lib/protocol/http2/stream.rb +42 -46
- data/lib/protocol/http2/version.rb +1 -1
- 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 +3 -3
- 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: 9fb7df701ecc5c31e840235686d8bf4a512d07d9ee86683757c674e57f5c45d5
|
4
|
+
data.tar.gz: 76081def8efb7a62eecb61927ccc1bb98add213ba90e57862c38775b1d7be6a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1d366a3b200bee1f997f13b5ec39a6ca033bde01b634737fe246005607ee97bb2c188b7afad8fef8bb991e246b7440bc5e2a805c20d189a94a7fc82b9d83ea
|
7
|
+
data.tar.gz: '03609bab9cbb8825443045dd63b3a7933c77389b1768d18262a8c4dbf3601273f5fe52c3c8fc69a3f3328dcd73ad0d283b0d20fbcaa9bcc81b1fb55a585912bf'
|
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
|
@@ -4,11 +4,11 @@
|
|
4
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
|
@@ -215,20 +215,20 @@ module Protocol
|
|
215
215
|
def write_frame(frame)
|
216
216
|
synchronize do
|
217
217
|
@framer.write_frame(frame)
|
218
|
+
|
219
|
+
# I tried moving this outside the synchronize block but it caused a deadlock.
|
220
|
+
@framer.flush
|
218
221
|
end
|
219
|
-
|
220
|
-
# The IO is already synchronized, and we don't want additional contention.
|
221
|
-
@framer.flush
|
222
222
|
end
|
223
223
|
|
224
224
|
def write_frames
|
225
225
|
if @framer
|
226
226
|
synchronize do
|
227
227
|
yield @framer
|
228
|
+
|
229
|
+
# See note above.
|
230
|
+
@framer.flush
|
228
231
|
end
|
229
|
-
|
230
|
-
# See above note.
|
231
|
-
@framer.flush
|
232
232
|
else
|
233
233
|
raise EOFError, "Connection closed!"
|
234
234
|
end
|
@@ -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.
|
@@ -3,18 +3,18 @@
|
|
3
3
|
# Released under the MIT License.
|
4
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 "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.1
|
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
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
|
-
rubygems_version: 3.5.
|
124
|
+
rubygems_version: 3.5.11
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: A low level implementation of the HTTP/2 protocol.
|
metadata.gz.sig
CHANGED
Binary file
|