Class: Protocol::HTTP2::PushPromiseFrame
- Defined in:
- lib/protocol/http2/push_promise_frame.rb
Overview
The PUSH_PROMISE frame is used to notify the peer endpoint in advance of streams the sender intends to initiate. The PUSH_PROMISE frame includes the unsigned 31-bit identifier of the stream the endpoint plans to create along with a set of headers that provide additional context for the stream.
---------------
|Pad Length? (8)| -
————------------------------------------------------
|R| Promised Stream ID (31) | -
—————————–-------------------------------
| Header Block Fragment (*) … ---------------------------------------------------------------
| Padding (*) … ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x5
- FORMAT =
"N".freeze
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
Methods included from Continued
#end_headers?, #initialize, #read, #write
Methods included from Padded
Methods inherited from Frame
#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, #inspect, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #valid_type?, #write, #write_header, #write_payload
Instance Method Details
#apply(connection) ⇒ Object
57 58 59 |
# File 'lib/protocol/http2/push_promise_frame.rb', line 57 def apply(connection) connection.receive_push_promise(self) end |
#pack(stream_id, data, *arguments, **options) ⇒ Object
53 54 55 |
# File 'lib/protocol/http2/push_promise_frame.rb', line 53 def pack(stream_id, data, *arguments, **) super([stream_id].pack(FORMAT) + data, *arguments, **) end |
#unpack ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/protocol/http2/push_promise_frame.rb', line 45 def unpack data = super stream_id = data.unpack1(FORMAT) return stream_id, data.byteslice(4, data.bytesize - 4) end |