http-2-next 0.4.0 → 0.4.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: 7db81040e42ff1170fbbcc93611c502b3b7fb1f3e4dcad7dd0ede42eaf08d0a4
4
- data.tar.gz: 3f6027a4d12dc034726040554a5ba4aab96c145ff7acc7fc6c8287afdc4b49d3
3
+ metadata.gz: 8fa01852fa00c35563fb999f007c1894c4b46a18a40d311d21908c42fc1b17f1
4
+ data.tar.gz: 7366509fdd22062f761abc7c4c6c46fa2e707ba953c17e3e86f449a67b5c38f1
5
5
  SHA512:
6
- metadata.gz: edb1d8dcf5509b2d51c64a66bf5396f7603817988b57894ba9529e877714c4c3ea847fd403ce75bb285a545a17758a8405277c9c36323425a2cd83d52ce842d7
7
- data.tar.gz: fff64e2206e276c3b174d309d8a32181058dfde60f507953a215d6d5850abb754e6db5c5a54247d946b61bf6a74b57a748d8f4138e9c8c533e18000bb69d40e3
6
+ metadata.gz: a8e6170d679b518d9de1fb1222d8a4c4996906e4a015a67d7418bb5c56af7c60e7551206303518612b16f19eddaaf1d50af96eb75d2611c7e4709a3f4401212c
7
+ data.tar.gz: 75c0652bc0b55feb14883841aa1119f4c0751ad5b435bd7e2de3443f8c6a354eaae25777c71c6fb1d9e35e90760af34c7a3319e418c5ccf5f44909f0741910c1
@@ -33,7 +33,7 @@ module HTTP2Next
33
33
  # @param block [Proc] callback function
34
34
  def emit(event, *args, &block)
35
35
  listeners(event).delete_if do |cb|
36
- cb.call(*args, &block) == :delete
36
+ :delete == cb.call(*args, &block) # rubocop:disable Style/YodaCondition
37
37
  end
38
38
  end
39
39
 
@@ -124,6 +124,8 @@ module HTTP2Next
124
124
 
125
125
  if frame
126
126
  case field
127
+ when ":status"
128
+ frame[:status] = Integer(value)
127
129
  when ":method"
128
130
  frame[:method] = value
129
131
  when "content-length"
@@ -88,7 +88,7 @@ module HTTP2Next
88
88
  @state = state
89
89
  @error = false
90
90
  @closed = false
91
- @_method = @_content_length = nil
91
+ @_method = @_content_length = @_status_code = nil
92
92
  @_waiting_on_trailers = false
93
93
  @received_data = false
94
94
 
@@ -126,12 +126,17 @@ module HTTP2Next
126
126
  stream_error(:stream_closed) if (@state == :closed && @closed != :local_rst) ||
127
127
  @state == :remote_closed
128
128
  @_method ||= frame[:method]
129
+ @_status_code ||= frame[:status]
129
130
  @_content_length ||= frame[:content_length]
130
131
  @_trailers ||= frame[:trailer]
131
132
  if @_waiting_on_trailers
132
133
  verify_trailers(frame)
133
- elsif @received_data
134
- stream_error(:protocol_error, msg: "already received data")
134
+ elsif @received_data &&
135
+ (!@_status_code || @_status_code >= 200)
136
+
137
+ # An endpoint that receives a HEADERS frame without the END_STREAM flag set after receiving a final
138
+ # (non-informational) status code MUST treat the corresponding request or response as malformed.
139
+ verify_trailers(frame)
135
140
  end
136
141
  emit(:headers, frame[:payload]) unless frame[:ignore]
137
142
  @_waiting_on_trailers = !@_trailers.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP2Next
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
data/sig/next.rbs CHANGED
@@ -65,7 +65,7 @@ module HTTP2Next
65
65
 
66
66
  type frame_key = :type | :flags | :stream | :padding | :ignore |
67
67
  # headers
68
- :method | :trailer | :content_length |
68
+ :method | :trailer | :content_length | :status |
69
69
  # data, settings, ping
70
70
  :payload | :length |
71
71
  # promise
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-2-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.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: 2021-02-21 00:00:00.000000000 Z
13
+ date: 2021-04-20 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Pure-ruby HTTP 2.0 protocol implementation
16
16
  email:
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  requirements: []
74
- rubygems_version: 3.2.3
74
+ rubygems_version: 3.2.15
75
75
  signing_key:
76
76
  specification_version: 4
77
77
  summary: Pure-ruby HTTP 2.0 protocol implementation