Protocol::HTTP2SourceProtocolHTTP2DataFrame

class DataFrame

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 () ... +---------------------------------------------------------------+

Definitions

def end_stream?

Check if this frame marks the end of the stream.

Signature

returns Boolean

True if the END_STREAM flag is set.

Implementation

def end_stream?
	flag_set?(END_STREAM)
end

def pack(data, *arguments, **options)

Pack data into the frame, handling empty data as stream end.

Signature

parameter data String | Nil

The data to pack into the frame.

parameter arguments Array

Additional arguments passed to super.

parameter options Hash

Additional options passed to super.

Implementation

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

def apply(connection)

Apply this DATA frame to a connection for processing.

Signature

parameter connection Connection

The connection to apply the frame to.

Implementation

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

def inspect

Provide a readable representation of the frame for debugging.

Signature

returns String

A formatted string representation of the frame.

Implementation

def inspect
	"\#<#{self.class} stream_id=#{@stream_id} flags=#{@flags} #{@length || 0}b>"
end