class Async::HTTP::Protocol::HTTP2::Stream

def process_headers(frame)

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!"
	end
	
	# TODO this might need to be in an ensure block:
	if @input and frame.end_stream?
		@input.close($!)
		@input = nil
	end
rescue ::Protocol::HTTP2::HeaderError => error
	Async.logger.error(self, error)
	
	send_reset_stream(error.code)
end