protocol-http2 0.27.0 → 0.29.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e218c8562a926b98f24ad707341e1ee24d26ed6ce94b9f6550049000f415cd2b
4
- data.tar.gz: 8ed236e94626982bd750d03a5c568c7b438e233b09256b671e5373db0881617c
3
+ metadata.gz: a7377cdf5d445fa9be8bb1e3598274a94430c5226d8cc3378dd3086fd439d779
4
+ data.tar.gz: 2e8dfd748cd7809bc8482151959860a45ff1d1b7e6406086622243894e43b080
5
5
  SHA512:
6
- metadata.gz: 31dfad736c2d3807ba103ccd70dea68d95375fe53f290582f805691c7b51cc43512494e2aae439c90082b0fbf518568c78e574bf9a3bb19dc4312127eb6378db
7
- data.tar.gz: 2ee408ca054cd3ae3eb205489ea0b7095fe896af11bcb810e377a627d824cd2b6440d013ace9ebba79886ac71c067a541209007c9ee169dcd78803c2be531172
6
+ metadata.gz: 40bc7ed544b4f29d054b6e949d832632ecd3e37c1d94c8dd188461075d848ea0784a41743491a63877b520f014cc224df5078d4f4fae964e7d44622998152c5e
7
+ data.tar.gz: 21f2c40d0c3c7259bc7fd620b788287691200fdd716d7a98a196fb4cd7d0f0b213a8fbeb518ffb06969c27c5732d04adafa369b1a6811ad1dca718f8e6f113f4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -510,6 +510,15 @@ module Protocol
510
510
 
511
511
  if stream = @streams[stream_id]
512
512
  stream.receive_headers(frame)
513
+ elsif local_stream_id?(stream_id) and closed_stream_id?(stream_id)
514
+ # This can occur if we reset a stream while the remote peer was sending headers for it,
515
+ # e.g. a response which was already in flight when the request was cancelled.
516
+ # The header block must still be decoded in order to keep the HPACK decoder state
517
+ # synchronized with the remote peer's encoder, but the decoded headers are discarded
518
+ # (RFC 9113 §5.1).
519
+ decode_headers(frame.unpack)
520
+
521
+ return nil
513
522
  else
514
523
  if stream_id <= @remote_stream_id
515
524
  raise ProtocolError, "Invalid stream id: #{stream_id} <= #{@remote_stream_id}!"
@@ -90,7 +90,7 @@ module Protocol
90
90
 
91
91
  remainder = data.byteslice(maximum_size, data.bytesize-maximum_size)
92
92
 
93
- @continuation = ContinuationFrame.new
93
+ @continuation = ContinuationFrame.new(@stream_id)
94
94
  @continuation.pack(remainder, maximum_size: maximum_size)
95
95
  else
96
96
  set_flags(END_HEADERS)
@@ -239,22 +239,21 @@ module Protocol
239
239
  return self
240
240
  end
241
241
 
242
- # The stream has been closed. If closed due to a stream reset, the error will be set.
242
+ # The stream has been closed. If closed due to a stream reset with a non-zero error code, the error will be set.
243
243
  def closed(error = nil)
244
244
  end
245
245
 
246
246
  # Transition the stream into the closed state.
247
- # @parameter error_code [Integer] the error code if the stream was closed due to a stream reset.
247
+ # @parameter error_code [Integer | Nil] The error code if the stream was closed due to a stream reset.
248
248
  def close!(error_code = nil)
249
249
  @state = :closed
250
250
  @connection.delete(@id)
251
251
 
252
- if error_code
253
- if error_code == REFUSED_STREAM
254
- error = ::Protocol::HTTP::RefusedError.new("Stream refused.")
255
- else
256
- error = StreamError.for(error_code)
257
- end
252
+ # `NO_ERROR` represents an orderly stream closure, so it is passed to `closed` as `nil` rather than converted to an exception.
253
+ if error_code == REFUSED_STREAM
254
+ error = ::Protocol::HTTP::RefusedError.new("Stream refused.")
255
+ elsif error_code && error_code != NO_ERROR
256
+ error = StreamError.for(error_code)
258
257
  end
259
258
 
260
259
  self.closed(error)
@@ -7,6 +7,6 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module HTTP2
10
- VERSION = "0.27.0"
10
+ VERSION = "0.29.1"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -14,6 +14,19 @@ Please see the [project documentation](https://socketry.github.io/protocol-http2
14
14
 
15
15
  Please see the [project releases](https://socketry.github.io/protocol-http2/releases/index) for all releases.
16
16
 
17
+ ### v0.29.1
18
+
19
+ - Sign releases with the Socketry release certificate.
20
+
21
+ ### v0.29.0
22
+
23
+ - Decode and discard `HEADERS` received for a locally-initiated stream which was already reset, e.g. a response in flight when the request was cancelled, rather than failing the connection with `ProtocolError`. This keeps the HPACK decoder state synchronized with the remote peer (RFC 9113 §5.1).
24
+ - `CONTINUATION` frames generated when packing a large header block now carry the stream ID of the frame they continue.
25
+
26
+ ### v0.28.0
27
+
28
+ - Treat `RST_STREAM(NO_ERROR)` as an orderly stream closure rather than constructing a `StreamError`.
29
+
17
30
  ### v0.27.0
18
31
 
19
32
  - On a graceful `GOAWAY` (error code `0`), keep the connection open until the streams the remote peer accepted have completed, instead of closing it immediately and failing those requests with `EOFError`.
@@ -43,20 +56,6 @@ Please see the [project releases](https://socketry.github.io/protocol-http2/rele
43
56
 
44
57
  - Introduce a limit to the number of CONTINUATION frames that can be read to prevent resource exhaustion. The default limit is 8 continuation frames, which means a total of 9 frames (1 initial + 8 continuation). This limit can be adjusted by passing a different value to the `limit` parameter in the `Continued.read` method. Setting the limit to 0 will only read the initial frame without any continuation frames. In order to change the default, you can redefine the `LIMIT` constant in the `Protocol::HTTP2::Continued` module, OR you can pass a different frame class to the framer.
45
58
 
46
- ### v0.22.1
47
-
48
- - Improved tracing performance by only tracing framer operations when in an active trace context.
49
- - Updated `protocol-http` dependency version in gemspec.
50
- - Code modernization and documentation improvements.
51
-
52
- ### v0.22.0
53
-
54
- - [Added Priority Update Frame and Stream Priority](https://socketry.github.io/protocol-http2/releases/index#added-priority-update-frame-and-stream-priority)
55
-
56
- ### v0.21.0
57
-
58
- - **Breaking**: Removed support for priority frame and stream dependencies. The `Protocol::HTTP2::Stream` class no longer tracks dependencies, and `Stream#send_headers` no longer takes `priority` as the first argument. This change simplifies the internal implementation significantly as HTTP/2 priority frames have been deprecated in the protocol specification.
59
-
60
59
  ## See Also
61
60
 
62
61
  - [Async::HTTP](https://github.com/socketry/async-http) - A high-level HTTP client and server implementation.
@@ -81,12 +80,14 @@ $ bundle exec sus
81
80
 
82
81
  ### Making Releases
83
82
 
84
- To make a new release:
83
+ To prepare a release branch and open a pull request from an up-to-date `main`:
85
84
 
86
85
  ``` bash
87
- $ bundle exec bake gem:release:patch # or minor or major
86
+ $ bundle exec bake gem:github:release:patch # or minor or major
88
87
  ```
89
88
 
89
+ See [bake-gem-github](https://github.com/socketry/bake-gem-github) for setup, remote releases, and recovery.
90
+
90
91
  ### Developer Certificate of Origin
91
92
 
92
93
  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.
data/releases.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Releases
2
2
 
3
+ ## v0.29.1
4
+
5
+ - Sign releases with the Socketry release certificate.
6
+
7
+ ## v0.29.0
8
+
9
+ - Decode and discard `HEADERS` received for a locally-initiated stream which was already reset, e.g. a response in flight when the request was cancelled, rather than failing the connection with `ProtocolError`. This keeps the HPACK decoder state synchronized with the remote peer (RFC 9113 §5.1).
10
+ - `CONTINUATION` frames generated when packing a large header block now carry the stream ID of the frame they continue.
11
+
12
+ ## v0.28.0
13
+
14
+ - Treat `RST_STREAM(NO_ERROR)` as an orderly stream closure rather than constructing a `StreamError`.
15
+
3
16
  ## v0.27.0
4
17
 
5
18
  - On a graceful `GOAWAY` (error code `0`), keep the connection open until the streams the remote peer accepted have completed, instead of closing it immediately and failing those requests with `EOFError`.
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.27.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -14,32 +14,28 @@ bindir: bin
14
14
  cert_chain:
15
15
  - |
16
16
  -----BEGIN CERTIFICATE-----
17
- MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
18
- ZWwud2lsbGlhbXMxHTAb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
44
40
  date: 1980-01-02 00:00:00.000000000 Z
45
41
  dependencies:
@@ -126,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
122
  - !ruby/object:Gem::Version
127
123
  version: '0'
128
124
  requirements: []
129
- rubygems_version: 4.0.10
125
+ rubygems_version: 4.0.21
130
126
  specification_version: 4
131
127
  summary: A low level implementation of the HTTP/2 protocol.
132
128
  test_files: []
metadata.gz.sig CHANGED
Binary file