Skip to content

blackbull.protocol.frame

blackbull.protocol.frame

HTTP/2 frame factory — parsing and creation.

FrameFactory produces frames of the requested type and decodes raw bytes from the wire. Frame-type definitions live in frame_types.

FrameFactory

docstring for FrameFactory

goaway(last_stream_id=0, error_code=0)

Create a GOAWAY frame.

RFC 9113 §6.8 — GOAWAY MUST be associated with the connection (stream identifier 0). The last_stream_id argument is the last-stream-id payload field, not the frame's stream identifier.

push_promise(parent_stream_id, promised_stream_id, pseudo_headers, headers)

Create a PUSH_PROMISE frame sent on parent_stream_id.

promised_stream_id must be an even server-allocated ID (RFC 7540 §5.1.1). pseudo_headers: dict mapping PseudoHeaders → str value. headers: list of (name, value) regular-header tuples.

rst_stream(stream_id, error_code)

Create a RST_STREAM frame with the given error code.

settings(*, ack=False, enable_connect_protocol=False, initial_window_size=None, max_concurrent_streams=None)

Create a SETTINGS frame (INIT or ACK).

Parameters

ack: True → ACK frame (no payload). enable_connect_protocol: Include SETTINGS_ENABLE_CONNECT_PROTOCOL=1 (RFC 8441 §3). initial_window_size: Include SETTINGS_INITIAL_WINDOW_SIZE (identifier 0x4, RFC 7540 §6.5.2). max_concurrent_streams: Include SETTINGS_MAX_CONCURRENT_STREAMS (identifier 0x3, RFC 7540 §6.5.2). Tells the peer the maximum number of concurrent streams we will accept.

window_update(stream_id, increment)

Create a WINDOW_UPDATE frame with the given increment.