Class: Protocol::HTTP2::HeadersFrame
- Defined in:
- lib/protocol/http2/headers_frame.rb
Overview
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 (*) … ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x1
Constants inherited from Frame
Frame::HEADER_FORMAT, Frame::LENGTH_HISHIFT, Frame::LENGTH_LOMASK, Frame::STREAM_ID_MASK, Frame::VALID_LENGTH, Frame::VALID_STREAM_ID
Instance Attribute Summary
Attributes included from Continued
Attributes inherited from Frame
#flags, #length, #payload, #stream_id, #type
Instance Method Summary collapse
- #apply(connection) ⇒ Object
- #end_stream? ⇒ Boolean
- #inspect ⇒ Object
- #pack(priority, data, *arguments, **options) ⇒ Object
- #priority? ⇒ Boolean
- #unpack ⇒ Object
Methods included from Continued
#end_headers?, #initialize, #read, #write
Methods included from Padded
Methods inherited from Frame
#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #valid_type?, #write, #write_header, #write_payload
Instance Method Details
#apply(connection) ⇒ Object
78 79 80 |
# File 'lib/protocol/http2/headers_frame.rb', line 78 def apply(connection) connection.receive_headers(self) end |
#end_stream? ⇒ Boolean
51 52 53 |
# File 'lib/protocol/http2/headers_frame.rb', line 51 def end_stream? flag_set?(END_STREAM) end |
#inspect ⇒ Object
82 83 84 |
# File 'lib/protocol/http2/headers_frame.rb', line 82 def inspect "\#<#{self.class} stream_id=#{@stream_id} flags=#{@flags} #{@length}b>" end |
#pack(priority, data, *arguments, **options) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/protocol/http2/headers_frame.rb', line 66 def pack(priority, data, *arguments, **) buffer = String.new.b if priority buffer << priority.pack end buffer << data super(buffer, *arguments, **) end |
#priority? ⇒ Boolean
47 48 49 |
# File 'lib/protocol/http2/headers_frame.rb', line 47 def priority? flag_set?(PRIORITY) end |