Class: Protocol::HTTP2::DataFrame
- Includes:
- Padded
- Defined in:
- lib/protocol/http2/data_frame.rb
Overview
DATA frames convey arbitrary, variable-length sequences of octets associated with a stream. One or more DATA frames are used, for instance, to carry HTTP request or response payloads.
DATA frames MAY also contain padding. Padding can be added to DATA frames to obscure the size of messages.
---------------
|Pad Length? (8)| ---------------
———————————————–+ | Data (*) … ---------------------------------------------------------------
| Padding (*) … ---------------------------------------------------------------
Constant Summary collapse
- TYPE =
0x0
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 inherited from Frame
#flags, #length, #payload, #stream_id, #type
Instance Method Summary collapse
- #apply(connection) ⇒ Object
- #end_stream? ⇒ Boolean
- #inspect ⇒ Object
- #pack(data, *arguments, **options) ⇒ Object
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, #unpack, #valid_type?, #write, #write_header, #write_payload
Constructor Details
This class inherits a constructor from Protocol::HTTP2::Frame
Instance Method Details
#apply(connection) ⇒ Object
57 58 59 |
# File 'lib/protocol/http2/data_frame.rb', line 57 def apply(connection) connection.receive_data(self) end |
#end_stream? ⇒ Boolean
44 45 46 |
# File 'lib/protocol/http2/data_frame.rb', line 44 def end_stream? flag_set?(END_STREAM) end |
#inspect ⇒ Object
61 62 63 |
# File 'lib/protocol/http2/data_frame.rb', line 61 def inspect "\#<#{self.class} stream_id=#{@stream_id} flags=#{@flags} #{@length}b>" end |
#pack(data, *arguments, **options) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/protocol/http2/data_frame.rb', line 48 def pack(data, *arguments, **) if data super else @length = 0 set_flags(END_STREAM) end end |