abstract struct HTTP2::Frame

Overview

This is an abstract superclass for all HTTP/2 Frames. The reference specification can be found at https://datatracker.ietf.org/doc/html/rfc7540#section-6.

A frame is a basic unit of data transmission in HTTP/2. Every frame has a type, specified by an 8-bit type code, a stream identifier which indicates which stream the frame belongs to, and a payload. Most Frame types also define a set of flags that differ based on the type of the Frame. Specific Frame types may have other considerations, such as padding length and padding bytes in Data frames, so consult the implementation and the reference specification for more information.

Direct Known Subclasses

Defined in:

frame.cr
frame/headers_helper.cr
frame/padding_helper.cr

Constant Summary

TYPES = [HTTP2::Frame::Data, HTTP2::Frame::Headers, HTTP2::Frame::Priority, HTTP2::Frame::ResetStream, HTTP2::Frame::Settings, HTTP2::Frame::PushPromise, HTTP2::Frame::Ping, HTTP2::Frame::GoAway, HTTP2::Frame::WindowUpdate, HTTP2::Frame::Continuation, HTTP2::Frame::AltSvc]

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.from_io(io : IO) #

[View source]
def self.from_type_code(type_code) #

[View source]
def self.parse_from_io(io : IO) #

[View source]
def self.type(type_code) #

[View source]

Instance Method Detail

def data #

[View source]
def error? #

This method may be overridden to do error checking on the frame, to determine if it might be invalid in some way.


[View source]
def initialize #

[View source]
def payload : Bytes #

[View source]
def stream #

[View source]
def stream_id : UInt32 #

[View source]
def to_s(io) #

This will output the frame in a wire compatible format. All frames are formatted identically.


| Length (24) |

| Type (8) |

| Flags (8) |

| Stream ID (31) |

| Payload (variable) |


[View source]