lib/async/http/protocol/http2/stream.rb in async-http-0.50.13 vs lib/async/http/protocol/http2/stream.rb in async-http-0.51.0
- old
+ new
@@ -59,12 +59,10 @@
@headers.add(key, value)
end
end
def receive_trailing_headers(headers, end_stream)
- @headers.trailers!
-
headers.each do |key, value|
if @trailers.include?(key)
add_header(key, value)
else
raise ::Protocol::HTTP2::HeaderError, "Cannot add trailer #{key} as it was not specified as a trailer!"
@@ -74,9 +72,10 @@
def process_headers(frame)
if @headers.nil?
@headers = ::Protocol::HTTP::Headers.new
self.receive_initial_headers(super, frame.end_stream?)
+
@trailers = @headers[TRAILERS]
elsif @trailers and frame.end_stream?
self.receive_trailing_headers(super, frame.end_stream?)
else
raise ::Protocol::HTTP2::HeaderError, "Unable to process headers!"