Class: HTTP::Protocol::HTTP2::DataFrame

Inherits:
Frame
  • Object
show all
Includes:
Padded
Defined in:
lib/http/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

Methods included from Padded

#padded?, #unpack

Methods inherited from Frame

#<=>, #clear_flags, #connection?, #flag_set?, #header, #initialize, parse_header, #read, #read_header, #read_payload, #set_flags, #to_ary, #unpack, #write, #write_header, #write_payload

Constructor Details

This class inherits a constructor from HTTP::Protocol::HTTP2::Frame

Instance Method Details

#apply(connection) ⇒ Object



58
59
60
# File 'lib/http/protocol/http2/data_frame.rb', line 58

def apply(connection)
	connection.receive_data(self)
end

#end_stream?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/http/protocol/http2/data_frame.rb', line 45

def end_stream?
	flag_set?(END_STREAM)
end

#pack(data) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/http/protocol/http2/data_frame.rb', line 49

def pack(data, *)
	if data
		super
	else
		@length = 0
		set_flags(END_STREAM)
	end
end