Protocol::HTTP2SourceProtocolHTTP2ResetStreamFrame

class ResetStreamFrame

The RST_STREAM frame allows for immediate termination of a stream. RST_STREAM is sent to request cancellation of a stream or to indicate that an error condition has occurred.

+---------------------------------------------------------------+ | Error Code (32) | +---------------------------------------------------------------+

Definitions

def unpack

Unpack the error code from the frame payload.

Signature

returns Integer

The error code.

Implementation

def unpack
	@payload.unpack1(FORMAT)
end

def pack(error_code = NO_ERROR)

Pack an error code into the frame payload.

Signature

parameter error_code Integer

The error code to pack.

Implementation

def pack(error_code = NO_ERROR)
	@payload = [error_code].pack(FORMAT)
	@length = @payload.bytesize
end

def apply(connection)

Apply this RST_STREAM frame to a connection for processing.

Signature

parameter connection Connection

The connection to apply the frame to.

Implementation

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

def read_payload(stream)

Read and validate the RST_STREAM frame payload.

Signature

parameter stream IO

The stream to read from.

raises FrameSizeError

If the frame length is invalid.

Implementation

def read_payload(stream)
	super
	
	if @length != 4
		raise FrameSizeError, "Invalid frame length"
	end
end