Class: HTTP::Protocol::HTTP2::PushPromiseFrame
- Defined in:
- lib/http/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, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #write, #write_header, #write_payload
Instance Method Details
#apply(connection) ⇒ Object
58 59 60 |
# File 'lib/http/protocol/http2/push_promise_frame.rb', line 58 def apply(connection) connection.receive_push_promise(self) end |
#pack(stream_id, data, *args) ⇒ Object
54 55 56 |
# File 'lib/http/protocol/http2/push_promise_frame.rb', line 54 def pack(stream_id, data, *args) super([stream_id].pack(FORMAT) + data, *args) end |
#unpack ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/http/protocol/http2/push_promise_frame.rb', line 46 def unpack data = super stream_id = data.unpack(FORMAT).first return stream_id, data.byteslice(4, data.bytesize - 4) end |