module HTTP2

Nested Classes and Modules

class Client

Represents an HTTP/2 client connection. Manages client-side protocol semantics including stream ID allocation, connection preface handling, and push promise processing.

class Connection

This is the core connection class that handles HTTP/2 protocol semantics including stream management, settings negotiation, and frame processing.

module Continued

Module for frames that can be continued with CONTINUATION frames.

class ContinuationFrame

The CONTINUATION frame is used to continue a sequence of header block fragments. Any number of CONTINUATION frames can be sent, as long as the preceding frame is on the same stream and is a HEADERS, PUSH_PROMISE, or CONTINUATION frame without the END_HEADERS flag set.

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.

class Error

Status codes as defined by https://tools.ietf.org/html/rfc7540#section-7.

class HandshakeError

Raised if connection header is missing or invalid indicating that this is an invalid HTTP 2.0 request - no frames are emitted and the connection must be aborted.

class ProtocolError

Raised by stream or connection handlers, results in GOAWAY frame which signals termination of the current connection. You cannot recover from this exception, or any exceptions subclassed from it.

class StreamError

Represents an error specific to stream operations.

class StreamClosed

Represents an error for operations on closed streams.

class GoawayError

Represents a GOAWAY-related protocol error.

class FrameSizeError

When the frame payload does not match expectations.

class HeaderError

Represents a header processing error.

class FlowControlError

Raised on invalid flow control frame or command.

module FlowControlled

Provides flow control functionality for HTTP/2 connections and streams. This module implements window-based flow control as defined in RFC 7540.

class Frame

Represents the base class for all HTTP/2 frames. This class provides common functionality for frame parsing, serialization, and manipulation according to RFC 7540.

class Framer

Handles frame serialization and deserialization for HTTP/2 connections. This class manages the reading and writing of HTTP/2 frames to/from a stream.

class GoawayFrame

The GOAWAY frame is used to initiate shutdown of a connection or to signal serious error conditions. GOAWAY allows an endpoint to gracefully stop accepting new streams while still finishing processing of previously established streams. This enables administrative actions, like server maintenance.

class HeadersFrame

The HEADERS frame is used to open a stream, and additionally carries a header block fragment. HEADERS frames can be sent on a stream in the "idle", "reserved (local)", "open", or "half-closed (remote)" state.

module Padded

Certain frames can have padding: https://http2.github.io/http2-spec/#padding

module Acknowledgement

Provides acknowledgement functionality for frames that support it. This module handles setting and checking acknowledgement flags on frames.

class PingFrame

The PING frame is a mechanism for measuring a minimal round-trip time from the sender, as well as determining whether an idle connection is still functional. PING frames can be sent from any endpoint.

class PriorityUpdateFrame

The PRIORITY_UPDATE frame is used by clients to signal the initial priority of a response, or to reprioritize a response or push stream. It carries the stream ID of the response and the priority in ASCII text, using the same representation as the Priority header field value.

class PushPromiseFrame

The PUSH_PROMISE frame is used to notify the peer endpoint in advance of streams the sender intends to initiate. The PUSH_PROMISE frame includes the unsigned 31-bit identifier of the stream the endpoint plans to create along with a set of headers that provide additional context for the stream.

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.

class Server

Represents an HTTP/2 server connection. Manages server-side protocol semantics including stream ID allocation, connection preface handling, and settings negotiation.

class Settings

HTTP/2 connection settings container and management.

class PendingSettings

Manages pending settings changes that haven't been acknowledged yet.

class SettingsFrame

The SETTINGS frame conveys configuration parameters that affect how endpoints communicate, such as preferences and constraints on peer behavior. The SETTINGS frame is also used to acknowledge the receipt of those parameters. Individually, a SETTINGS parameter can also be referred to as a "setting".

class Stream

A single HTTP/2 connection can multiplex multiple streams in parallel: multiple requests and responses can be in flight simultaneously and stream data can be interleaved and prioritized.

class Window

Flow control window for managing HTTP/2 data flow.

class LocalWindow

This is a window which efficiently maintains a desired capacity.

class WindowUpdateFrame

The WINDOW_UPDATE frame is used to implement flow control.

Definitions

FRAMES

HTTP/2 frame type mapping as defined by the spec

Implementation

FRAMES = [
	DataFrame,
	HeadersFrame,
	nil, # PriorityFrame is deprecated and ignored, instead consider using PriorityUpdateFrame instead.
	ResetStreamFrame,
	SettingsFrame,
	PushPromiseFrame,
	PingFrame,
	GoawayFrame,
	WindowUpdateFrame,
	ContinuationFrame,
	nil,
	nil,
	nil,
	nil,
	nil,
	nil,
	PriorityUpdateFrame,
].freeze

CONNECTION_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".freeze

Default connection "fast-fail" preamble string as defined by the spec.