class Async::HTTP::Protocol::HTTP2::Request

def receive_headers(stream, headers, end_stream)

def receive_headers(stream, headers, end_stream)
	headers.each do |key, value|
		if key == SCHEME
			return @stream.send_failure(400, "Request scheme already specified") if @scheme
			
			@scheme = value
		elsif key == AUTHORITY
			return @stream.send_failure(400, "Request authority already specified") if @authority
			
			@authority = value
		elsif key == METHOD
			return @stream.send_failure(400, "Request method already specified") if @method
			
			@method = value
		elsif key == PATH
			return @stream.send_failure(400, "Request path already specified") if @path
			
			@path = value
		elsif key == PROTOCOL
			return @stream.send_failure(400, "Request protocol already specified") if @protocol
			
			@protocol = value
		elsif key == CONTENT_LENGTH
			return @stream.send_failure(400, "Request protocol already content length") if @length
			
			@length = Integer(value)
		else
			@headers[key] = value
		end
	end
	
	unless @scheme and @method and @path
		send_reset_stream(PROTOCOL_ERROR)
	else
		# We only construct the input/body if data is coming.
		unless end_stream
			@body = @input = Body::Writable.new(@length)
		end
		
		# We are ready for processing:
		@connection.requests.enqueue(self)
	end
end