Skip to content

Commit

Permalink
Better logic for interim headers, headers and trailers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0fcff69 commit 499c764
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/async/http/protocol/http2/stream.rb
Original file line number Diff line number Diff line change
@@ -50,13 +50,11 @@ def receive_trailing_headers(headers, end_stream)
end

def process_headers(frame)
if @headers.nil?
@headers = ::Protocol::HTTP::Headers.new
self.receive_initial_headers(super, frame.end_stream?)
elsif frame.end_stream?
if frame.end_stream? && @headers
self.receive_trailing_headers(super, frame.end_stream?)
else
raise ::Protocol::HTTP2::HeaderError, "Unable to process headers!"
@headers ||= ::Protocol::HTTP::Headers.new
self.receive_initial_headers(super, frame.end_stream?)
end

# TODO this might need to be in an ensure block:

0 comments on commit 499c764

Please sign in to comment.