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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3d7de9d5cea0bc568ee4cfe9c36ec1857d3e268b5b183bda0602fb66862faf3
4
- data.tar.gz: 2a5e7b2fae05cb3ff96cc821160f745e80ffd45eef1363ea99c4c029853f5073
3
+ metadata.gz: 9fb7df701ecc5c31e840235686d8bf4a512d07d9ee86683757c674e57f5c45d5
4
+ data.tar.gz: 76081def8efb7a62eecb61927ccc1bb98add213ba90e57862c38775b1d7be6a8
5
5
  SHA512:
6
- metadata.gz: 15841f05ca83452964396dd3e9b2c7d0f7dd456d38495772545e3a57b1991a589a3fb68b99721c3303af76318dde23b8d8839242310da172b5ef715efcc0da61
7
- data.tar.gz: 7148bc4ba24d364960beee692fce5f7be577bc147045ae1a829cb26b64c363501307359b998c16e36bd6bcfcfb6a2405f7f93d4ed8db2c231b5a1be814792fd9
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'connection'
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 'framer'
8
- require_relative 'dependency'
9
- require_relative 'flow_controlled'
7
+ require_relative "framer"
8
+ require_relative "dependency"
9
+ require_relative "flow_controlled"
10
10
 
11
- require 'protocol/hpack'
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,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
7
- require_relative 'padded'
6
+ require_relative "frame"
7
+ require_relative "padded"
8
8
 
9
9
  module Protocol
10
10
  module HTTP2
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require 'protocol/http/error'
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
  # Copyright, 2019, by Yuta Iwama.
6
6
 
7
- require_relative 'window_update_frame'
7
+ require_relative "window_update_frame"
8
8
 
9
9
  module Protocol
10
10
  module HTTP2
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
  # Copyright, 2019, by Yuta Iwama.
6
6
 
7
- require_relative 'error'
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 = 'CnCCN'.freeze
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 'error'
6
+ require_relative "error"
7
7
 
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'
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,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
7
7
 
8
8
  module Protocol
9
9
  module HTTP2
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
7
- require_relative 'padded'
8
- require_relative 'continuation_frame'
9
- require_relative 'priority_frame'
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,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
7
7
 
8
8
  module Protocol
9
9
  module HTTP2
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
7
- require_relative 'padded'
8
- require_relative 'continuation_frame'
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
7
7
 
8
8
  module Protocol
9
9
  module HTTP2
@@ -3,7 +3,7 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'connection'
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'ping_frame'
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-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'connection'
7
- require_relative 'dependency'
6
+ require_relative "connection"
7
+ require_relative "dependency"
8
8
 
9
9
  module Protocol
10
10
  module HTTP2
11
- # A single HTTP 2.0 connection can multiplex multiple streams in parallel:
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
- # send PP | | recv PP
23
- # ,--------| idle |--------.
24
- # / | | \
25
- # v +--------+ v
26
- # +----------+ | +----------+
27
- # | | | send H / | |
28
- # ,------| reserved | | recv H | reserved |------.
29
- # | | (local) | | | (remote) | |
30
- # | +----------+ v +----------+ |
31
- # | | +--------+ | |
32
- # | | recv ES | | send ES | |
33
- # | send H | ,-------| open |-------. | recv H |
34
- # | | / | | \ | |
35
- # | v v +--------+ v v |
36
- # | +----------+ | +----------+ |
37
- # | | half | | | half | |
38
- # | | closed | | send R / | closed | |
39
- # | | (remote) | | recv R | (local) | |
40
- # | +----------+ | +----------+ |
41
- # | | | | |
42
- # | | send ES / | recv ES / | |
43
- # | | send R / v send R / | |
44
- # | | recv R +--------+ recv R | |
45
- # | send R / `----------->| |<-----------' send R / |
46
- # | recv R | closed | recv R |
47
- # `----------------------->| |<----------------------'
48
- # +--------+
49
- #
50
- # send: endpoint sends this frame
51
- # recv: endpoint receives this frame
52
- #
53
- # H: HEADERS frame (with implied CONTINUATIONs)
54
- # PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
55
- # ES: END_STREAM flag
56
- # R: RST_STREAM frame
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
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP2
8
- VERSION = "0.18.0"
8
+ VERSION = "0.19.1"
9
9
  end
10
10
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'frame'
6
+ require_relative "frame"
7
7
 
8
8
  module Protocol
9
9
  module HTTP2
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2019-2023, by Samuel Williams.
4
+ # Copyright, 2019-2024, by Samuel Williams.
5
5
 
6
- require_relative 'http2/version'
7
- require_relative 'http2/connection'
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
- 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.
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
- ### Contributor Covenant
104
+ ### Community Guidelines
105
105
 
106
- This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
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.18.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-06-10 00:00:00.000000000 Z
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.9
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