class Protocol::HTTP2::HeadersFrame


---------------------------------------------------------------
| Padding (*) …
---------------------------------------------------------------
| Header Block Fragment (*) …
-————------------------------------------------------
| Weight? (8) |
-————------------------------------------------------
|E| Stream Dependency? (31) |
-————------------------------------------------------
|Pad Length? (8)|
---------------
The HEADERS frame is used to open a stream, and additionally carries a header block fragment. HEADERS frames can be sent on a stream in the “idle”, “reserved (local)”, “open”, or “half-closed (remote)” state.

def apply(connection)

def apply(connection)
	connection.receive_headers(self)
end

def end_stream?

def end_stream?
	flag_set?(END_STREAM)
end

def inspect

def inspect
	"\#<#{self.class} stream_id=#{@stream_id} flags=#{@flags} #{@length || 0}b>"
end

def pack(priority, data, *arguments, **options)

def pack(priority, data, *arguments, **options)
	buffer = String.new.b
	
	if priority
		buffer << priority.pack
		set_flags(PRIORITY)
	else
		clear_flags(PRIORITY)
	end
	
	buffer << data
	
	super(buffer, *arguments, **options)
end

def priority?

def priority?
	flag_set?(PRIORITY)
end

def unpack

def unpack
	data = super
	
	if priority?
		priority = Priority.unpack(data)
		data = data.byteslice(5, data.bytesize - 5)
	end
	
	return priority, data
end