http-2 1.0.0 → 1.0.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: c5b015395ca278b22ea3af7f2c0c149071ddb1ad4cd5db5c52329554de87fe27
4
- data.tar.gz: 3f7a6d671bd23efe5b60f16dc39294b6cd7a45d6087ff1be70f0624f682895a5
3
+ metadata.gz: 96271a021aa473e7c555c6ceca6509f30e4ad457051e3971304c5a841afe4ca6
4
+ data.tar.gz: 5f2284ff6211f414291337d4efe260fc52bb9e18ccdb8bf19408ae781469994c
5
5
  SHA512:
6
- metadata.gz: ce8dff286d18b7607a338572b9b85ab2ff88eb8a28b8de8a6139344d0cc2f3ebc700ca9affc8398526b88fb95b7fe5da90209c5c6fbdff155c319f9e8691062b
7
- data.tar.gz: b7f920fc81747d811855eec66a8f63e5a18d5a8ca49d81efe8f6567c6c72a1275c4846219a1532855834717453a7e0d914d3138296fb24876f5af3d9c3151772
6
+ metadata.gz: 6a3f9b4f1a98f232405b85559c91d976c0712defe2cfe1e1ef4468bc81b7e278abd162f3e0de8828dddcdfaff11808a0cab7c794353f5224303eb8b00a4b44ec
7
+ data.tar.gz: e14c1ec4652af944dfa791dacae8af519982c04b652b9ef352a1aa2377a15c80f829a2654da7c6e556680d522c7405137e4e5ab24dcb68e196eeb41e5ad54a18
@@ -294,13 +294,13 @@ module HTTP2
294
294
  if stream.nil?
295
295
  verify_pseudo_headers(frame)
296
296
 
297
+ verify_stream_order(frame[:stream])
297
298
  stream = activate_stream(
298
299
  id: frame[:stream],
299
300
  weight: frame[:weight] || DEFAULT_WEIGHT,
300
301
  dependency: frame[:dependency] || 0,
301
302
  exclusive: frame[:exclusive] || false
302
303
  )
303
- verify_stream_order(stream.id)
304
304
  emit(:stream, stream)
305
305
  end
306
306
 
@@ -354,8 +354,8 @@ module HTTP2
354
354
  end
355
355
 
356
356
  _verify_pseudo_headers(frame, REQUEST_MANDATORY_HEADERS)
357
+ verify_stream_order(pid)
357
358
  stream = activate_stream(id: pid, parent: parent)
358
- verify_stream_order(stream.id)
359
359
  emit(:promise, stream)
360
360
  stream << frame
361
361
  else
@@ -391,6 +391,13 @@ module HTTP2
391
391
  stream = @streams_recently_closed[frame[:stream]]
392
392
  connection_error(:protocol_error, msg: "sent window update on idle stream") unless stream
393
393
  process_window_update(frame: frame, encode: true)
394
+ # Endpoints MUST ignore
395
+ # WINDOW_UPDATE or RST_STREAM frames received in this state (closed), though
396
+ # endpoints MAY choose to treat frames that arrive a significant
397
+ # time after sending END_STREAM as a connection error.
398
+ when :rst_stream
399
+ stream = @streams_recently_closed[frame[:stream]]
400
+ connection_error(:protocol_error, msg: "sent window update on idle stream") unless stream
394
401
  else
395
402
  # An endpoint that receives an unexpected stream identifier
396
403
  # MUST respond with a connection error of type PROTOCOL_ERROR.
@@ -744,6 +751,8 @@ module HTTP2
744
751
  stream = Stream.new(connection: self, id: id, **args)
745
752
 
746
753
  stream.once(:close) do
754
+ @streams.delete(id)
755
+
747
756
  # Store a reference to the closed stream, such that we can respond
748
757
  # to any in-flight frames while close is registered on both sides.
749
758
  # References to such streams will be purged whenever another stream
@@ -767,7 +776,7 @@ module HTTP2
767
776
  def verify_stream_order(id)
768
777
  return unless id.odd?
769
778
 
770
- connection_error(msg: "Stream ID smaller than previous") if @last_stream_id > id
779
+ connection_error(msg: "Stream ID smaller than previous") if @last_stream_id >= id
771
780
  @last_stream_id = id
772
781
  end
773
782
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP2
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-06-28 00:00:00.000000000 Z
13
+ date: 2024-07-26 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Pure-ruby HTTP 2.0 protocol implementation
16
16
  email: