class Protocol::HTTP2::HeadersFrame

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.

--------------- |Pad Length? (8)| -————------------------------------------------------ |E| Stream Dependency? (31) | -————------------------------------------------------ | Weight? (8) | -————------------------------------------------------ | Header Block Fragment (*) … --------------------------------------------------------------- | Padding (*) … ---------------------------------------------------------------

Constants

TYPE

Public Instance Methods

apply(connection) click to toggle source
# File lib/protocol/http2/headers_frame.rb, line 81
def apply(connection)
        connection.receive_headers(self)
end
end_stream?() click to toggle source
# File lib/protocol/http2/headers_frame.rb, line 51
def end_stream?
        flag_set?(END_STREAM)
end
inspect() click to toggle source
# File lib/protocol/http2/headers_frame.rb, line 85
def inspect
        "\#<#{self.class} stream_id=#{@stream_id} flags=#{@flags} #{@length}b>"
end
pack(priority, data, *arguments, **options) click to toggle source
Calls superclass method Protocol::HTTP2::Frame#pack
# File lib/protocol/http2/headers_frame.rb, line 66
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
priority?() click to toggle source
# File lib/protocol/http2/headers_frame.rb, line 47
def priority?
        flag_set?(PRIORITY)
end
unpack() click to toggle source
Calls superclass method Protocol::HTTP2::Frame#unpack
# File lib/protocol/http2/headers_frame.rb, line 55
def unpack
        data = super
        
        if priority?
                priority = Priority.unpack(data)
                data = data.byteslice(5, data.bytesize - 5)
        end
        
        return priority, data
end