nish/net/http2-frame

The frames of HTTP/2 (RFC 9113 §4 and §6): the nine-byte header, every one of the ten frame types read and written, and the size, flag, padding and stream-identifier rules each one carries.

import {
  H2_CANCEL,
  H2_COMPRESSION_ERROR,
  H2_CONNECT_ERROR,
  H2_DEFAULT_MAX_FRAME,
  H2_DEFAULT_WINDOW,
  H2_ENHANCE_YOUR_CALM,
  H2_FLAG_ACK,
  H2_FLAG_END_HEADERS,
  H2_FLAG_END_STREAM,
  H2_FLAG_PADDED,
  H2_FLAG_PRIORITY,
  H2_FLOW_CONTROL_ERROR,
  H2_FRAME_CONTINUATION,
  H2_FRAME_DATA,
  H2_FRAME_GOAWAY,
  H2_FRAME_HEADERS,
  H2_FRAME_HEADER_SIZE,
  H2_FRAME_PING,
  H2_FRAME_PRIORITY,
  H2_FRAME_PUSH_PROMISE,
  H2_FRAME_RST_STREAM,
  H2_FRAME_SETTINGS,
  H2_FRAME_SIZE_ERROR,
  H2_FRAME_WINDOW_UPDATE,
  H2_HTTP_1_1_REQUIRED,
  H2_INADEQUATE_SECURITY,
  H2_INTERNAL_ERROR,
  H2_MAX_FRAME_LIMIT,
  H2_MAX_WINDOW,
  H2_NO_ERROR,
  H2_PROTOCOL_ERROR,
  H2_REFUSED_STREAM,
  H2_SETTINGS_ENABLE_CONNECT_PROTOCOL,
  H2_SETTINGS_ENABLE_PUSH,
  H2_SETTINGS_HEADER_TABLE_SIZE,
  H2_SETTINGS_INITIAL_WINDOW_SIZE,
  H2_SETTINGS_MAX_CONCURRENT_STREAMS,
  H2_SETTINGS_MAX_FRAME_SIZE,
  H2_SETTINGS_MAX_HEADER_LIST_SIZE,
  H2_SETTINGS_TIMEOUT,
  H2_SETTING_SIZE,
  H2_STREAM_CLOSED,
  Http2Frame,
  http2ParseFrame,
  http2ReadHeader,
  http2SettingCount,
  http2SettingError,
  http2SettingId,
  http2SettingValue,
  http2WriteContinuation,
  http2WriteData,
  http2WriteGoaway,
  http2WriteHeader,
  http2WriteHeaders,
  http2WritePing,
  http2WritePriority,
  http2WritePushPromise,
  http2WriteRstStream,
  http2WriteSettings,
  http2WriteSettingsAck,
  http2WriteWindowUpdate,
} from "nish/net/http2-frame";
import {
  H2_FLAG_END_STREAM, Http2Frame, http2ReadHeader, http2ParseFrame, http2WriteData,
} from "nish/net/http2-frame";

// `buf[off, off + len)` is what the peer sent; `maxFrameSize` is this side's SETTINGS_MAX_FRAME_SIZE.
const read = (frame: Http2Frame, buf: u8[], off: i32, len: i32, maxFrameSize: i32): void => {
  if (http2ReadHeader(frame, buf, off, len) && len >= 9 + frame.length) {
    const error: i32 = http2ParseFrame(frame, buf, off, maxFrameSize);
    // 0, or the connection error to close with; frame.streamError, the
    // stream error to reset the stream with; then buf[frame.contentStart ..
    // frame.contentStart + frame.contentLength) is the DATA, the header
    // block fragment or the GOAWAY debug data.
  }
};
// `body[0, n)` goes into `out` at `at` as the last DATA of `streamId`; `end` is the offset after it.
const send = (out: u8[], at: i32, streamId: i32, body: u8[], n: i32): void => {
  const end: i32 = http2WriteData(out, at, streamId, body, 0, n, H2_FLAG_END_STREAM, -1);
};

It is sans-IO, like every lane of WP34 §5 below the sockets, and it never allocates: a frame is read out of the caller's buffer into an Http2Frame the caller reuses, its content left where it lies as a window, and a frame is written into the caller's buffer at an offset.

What a parse refuses, as the error code RFC 9113 names, which closes the connection: a frame longer than the receiver's SETTINGS_MAX_FRAME_SIZE (FRAME_SIZE_ERROR, §4.2); DATA, HEADERS, PRIORITY, RST_STREAM, PUSH_PROMISE or CONTINUATION on stream 0, and SETTINGS, PING or GOAWAY on any other (PROTOCOL_ERROR); a frame too short for its fixed fields, a RST_STREAM or WINDOW_UPDATE that is not four bytes, a PING that is not eight, a SETTINGS whose length is not a multiple of six or an ACK with a payload, and a GOAWAY under eight (FRAME_SIZE_ERROR); padding as long as what it pads or longer (PROTOCOL_ERROR, §6.1); and a WINDOW_UPDATE of zero on the connection (PROTOCOL_ERROR, §6.9).

Two refusals only reset the stream, and come back in streamError with a parse that answers 0: a PRIORITY of the wrong length (FRAME_SIZE_ERROR, §6.3), and a WINDOW_UPDATE of zero on a stream (PROTOCOL_ERROR). A HEADERS or PRIORITY that makes a stream depend on itself is the same (PROTOCOL_ERROR, §5.3.1). A frame of a type this module does not know is read and answers 0: §4.1 says it is ignored, and that is the connection's to do.

SETTINGS values are checked one at a time by http2SettingError, because which value a refusal names is the reader's business (§6.5.2): an ENABLE_PUSH or ENABLE_CONNECT_PROTOCOL other than 0 or 1, and a MAX_FRAME_SIZE outside 2^14 to 2^24 − 1, are PROTOCOL_ERROR; an INITIAL_WINDOW_SIZE past 2^31 − 1 is FLOW_CONTROL_ERROR.

The writers

The writers answer the offset after the frame, or -1 when it would not fit in the buffer, which is then unchanged; a window outside its source buffer, a stream identifier outside 0 to 2^31 − 1 and padding past 255 are the program's mistakes and panic. The writers of a frame type write none the reader refuses, so a program cannot send what its peer must close for, save a payload past the peer's SETTINGS_MAX_FRAME_SIZE, which they cannot know: they stop at 2^24 − 1. http2WriteHeader checks no type's rules.

Private helpers share the importing program's flat symbol namespace (docs/wp26-stdlib.md §3e), which is why each one carries the module's name.

Written from RFC 9113, not ported from another implementation.

Functions

http2ParseFrame

Parses the frame whose header http2ReadHeader read from buf[off]; its whole payload must be in buf. maxFrameSize is the reader's SETTINGS_MAX_FRAME_SIZE. Answers 0, with the type's fields set and any stream error in streamError, or the connection error the module comment lists.

const http2ParseFrame: (
  frame: Http2Frame,
  buf: u8[],
  off: i32,
  maxFrameSize: i32,
) => i32
frameHttp2Framerequired

The frame http2ReadHeader filled from the same buf and off; its content window, padding, priority fields, streamError and the parsed type's own fields are set.

bufu8[]required

The bytes received; the content window points into it, so it must stay as it is while the content is read. [off, off + 9 + frame.length) outside buf panics.

offi32required

Where the frame's header starts in buf.

maxFrameSizei32required

This side's SETTINGS_MAX_FRAME_SIZE in bytes; a longer payload is refused.

returnsi32

0 (H2_NO_ERROR) when the frame is accepted, streamError then holding 0 or the stream error to reset with (H2_FRAME_SIZE_ERROR or H2_PROTOCOL_ERROR); otherwise the connection error to close with, H2_FRAME_SIZE_ERROR or H2_PROTOCOL_ERROR.

http2ReadHeader

Reads the nine-byte header at buf[off] into frame, when len bytes from off hold one, and answers whether they did. The payload need not be there yet: a reader checks frame.length against its limit before it waits for the rest, which is what keeps a peer from making it buffer more.

const http2ReadHeader: (
  frame: Http2Frame,
  buf: u8[],
  off: i32,
  len: i32,
) => boolean
frameHttp2Framerequired

The frame its length, type, flags and stream identifier are written into; left as it was when the header is not all there.

bufu8[]required

The bytes received, read and not kept.

offi32required

Where the header starts in buf.

leni32required

How many bytes from off have arrived; [off, off + len) outside buf panics.

returnsboolean

True when nine bytes were there and the header was read; false when fewer were, with frame untouched, so the reader waits for more.

http2SettingCount

How many settings a SETTINGS frame http2ParseFrame accepted carries.

const http2SettingCount: (frame: Http2Frame) => i32
frameHttp2Framerequired

The SETTINGS frame just parsed.

returnsi32

The payload's length over six: 0 for an ACK or an empty SETTINGS.

http2SettingError

The connection error a setting's value is, or 0 (§6.5.2, RFC 8441 §3). A setting this module does not know is not an error: §6.5.2 says it is ignored.

const http2SettingError: (id: i32, value: i64) => i32
idi32required

The setting's identifier, as http2SettingId reads it.

valuei64required

The setting's value, as http2SettingValue reads it, 0 to 2^32 − 1.

returnsi32

H2_PROTOCOL_ERROR for an ENABLE_PUSH or ENABLE_CONNECT_PROTOCOL above 1 or a MAX_FRAME_SIZE outside 2^14 to 2^24 − 1; H2_FLOW_CONTROL_ERROR for an INITIAL_WINDOW_SIZE above 2^31 − 1; otherwise 0, every other identifier included.

http2SettingId

The identifier of setting k of the SETTINGS frame in buf.

const http2SettingId: (
  frame: Http2Frame,
  buf: u8[],
  k: i32,
) => i32
frameHttp2Framerequired

The SETTINGS frame http2ParseFrame accepted.

bufu8[]required

The buffer that frame was read from, unchanged since.

ki32required

Which setting, 0 to http2SettingCount(frame) − 1; nothing here checks the bound.

returnsi32

The 16-bit identifier, 0 to 65,535: an H2_SETTINGS_*, or one this module does not know.

http2SettingValue

The value of setting k of the SETTINGS frame in buf.

const http2SettingValue: (
  frame: Http2Frame,
  buf: u8[],
  k: i32,
) => i64
frameHttp2Framerequired

The SETTINGS frame http2ParseFrame accepted.

bufu8[]required

The buffer that frame was read from, unchanged since.

ki32required

Which setting, 0 to http2SettingCount(frame) − 1; nothing here checks the bound.

returnsi64

The value as sent, 0 to 2^32 − 1, not yet checked: http2SettingError checks it.

http2WriteContinuation

Writes a CONTINUATION frame of the header block fragment src[off, off + len), with flags (END_HEADERS) (§6.10). It is never padded.

const http2WriteContinuation: (
  out: u8[],
  at: i32,
  streamId: i32,
  src: u8[],
  off: i32,
  len: i32,
  flags: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream whose header block this continues, 1 to 2^31 − 1; 0 or a negative identifier panics.

srcu8[]required

The buffer holding the fragment; copied, not kept.

offi32required

Where the fragment starts in src.

leni32required

The fragment's length in bytes; [off, off + len) outside src panics, and so does a payload past 2^24 − 1 bytes. Keeping it within the peer's SETTINGS_MAX_FRAME_SIZE is the caller's.

flagsi32required

H2_FLAG_END_HEADERS or 0; any other bit is dropped.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteData

Writes a DATA frame of src[off, off + len) on streamId, with flags (END_STREAM) and pad bytes of padding, -1 for none (§6.1).

const http2WriteData: (
  out: u8[],
  at: i32,
  streamId: i32,
  src: u8[],
  off: i32,
  len: i32,
  flags: i32,
  pad: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream the data belongs to, 1 to 2^31 − 1; 0 or a negative identifier panics.

srcu8[]required

The buffer holding the data; copied, not kept.

offi32required

Where the data starts in src.

leni32required

The data's length in bytes; [off, off + len) outside src panics, and so does a payload past 2^24 − 1 bytes. Keeping it within the peer's SETTINGS_MAX_FRAME_SIZE is the caller's.

flagsi32required

H2_FLAG_END_STREAM or 0; any other bit is dropped.

padi32required

Bytes of zero padding, 0 to 255, or -1 (any negative) for none; past 255 panics. PADDED is set from it, never from flags.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteGoaway

Writes a GOAWAY frame naming lastStreamId and code, with the debug data debug[off, off + len) (§6.8).

const http2WriteGoaway: (
  out: u8[],
  at: i32,
  lastStreamId: i32,
  code: i64,
  debug: u8[],
  off: i32,
  len: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

lastStreamIdi32required

The highest peer-opened stream this side may have processed, 0 to 2^31 − 1; a negative one panics.

codei64required

The error code, an H2_* of §7 or another 32-bit value; only its low 32 bits are sent.

debugu8[]required

The buffer holding the debug data; copied, not kept.

offi32required

Where the debug data starts in debug.

leni32required

The debug data's length in bytes, 0 for none; [off, off + len) outside debug panics, and so does a payload past 2^24 − 1 bytes.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteHeader

Writes a frame header at out[at] for a payload of length bytes, and answers where the payload goes, or -1 when the header and the payload would not both fit. It checks no type's rules: the payload is the caller's to write.

const http2WriteHeader: (
  out: u8[],
  at: i32,
  length: i32,
  type: i32,
  flags: i32,
  streamId: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

lengthi32required

The payload's length in bytes, 0 to 2^24 − 1; outside that panics.

typei32required

The frame type byte, an H2_FRAME_* or another 0 to 255; only its low 8 bits are written.

flagsi32required

The flags byte, unchecked; only its low 8 bits are written.

streamIdi32required

The stream identifier, 0 for the connection, to 2^31 − 1; a negative one panics.

returnsi32

at + 9, where the payload goes, or -1 when out has no room for the header and length bytes after it, out then unchanged.

http2WriteHeaders

Writes a HEADERS frame carrying the header block fragment src[off, off + len) on streamId, with flags (END_STREAM, END_HEADERS) and pad bytes of padding, -1 for none (§6.2). It never sets PRIORITY, which RFC 9113 deprecates.

const http2WriteHeaders: (
  out: u8[],
  at: i32,
  streamId: i32,
  src: u8[],
  off: i32,
  len: i32,
  flags: i32,
  pad: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream the headers open or belong to, 1 to 2^31 − 1; 0 or a negative identifier panics.

srcu8[]required

The buffer holding the fragment; copied, not kept.

offi32required

Where the fragment starts in src.

leni32required

The fragment's length in bytes; [off, off + len) outside src panics, and so does a payload past 2^24 − 1 bytes. Keeping it within the peer's SETTINGS_MAX_FRAME_SIZE is the caller's.

flagsi32required

H2_FLAG_END_STREAM and H2_FLAG_END_HEADERS, either or both or neither; any other bit is dropped.

padi32required

Bytes of zero padding, 0 to 255, or -1 (any negative) for none; past 255 panics. PADDED is set from it, never from flags.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WritePing

Writes a PING frame of the eight bytes opaque[off, off + 8), an ACK when ack (§6.7).

const http2WritePing: (
  out: u8[],
  at: i32,
  opaque: u8[],
  off: i32,
  ack: boolean,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

opaqueu8[]required

The buffer holding the eight bytes; copied, not kept.

offi32required

Where the eight bytes start in opaque; [off, off + 8) outside it panics.

ackbooleanrequired

Whether this answers the peer's PING, its bytes echoed, rather than asking.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WritePriority

Writes a PRIORITY frame: streamId depends on dependency, exclusively or not, with weight 1 to 256 (§6.3).

const http2WritePriority: (
  out: u8[],
  at: i32,
  streamId: i32,
  dependency: i32,
  exclusive: boolean,
  weight: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream whose priority this sets, 1 to 2^31 − 1; 0 or a negative identifier panics.

dependencyi32required

The stream it depends on, 0 to 2^31 − 1; negative, or streamId itself, panics.

exclusivebooleanrequired

Whether the dependency is exclusive (§5.3.1).

weighti32required

The weight, 1 to 256, sent as one less; outside that panics.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WritePushPromise

Writes a PUSH_PROMISE frame on streamId reserving promisedId, carrying the header block fragment src[off, off + len), with flags (END_HEADERS) and pad bytes of padding, -1 for none (§6.6).

const http2WritePushPromise: (
  out: u8[],
  at: i32,
  streamId: i32,
  promisedId: i32,
  src: u8[],
  off: i32,
  len: i32,
  flags: i32,
  pad: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream of the request the promise answers, 1 to 2^31 − 1; 0 or a negative identifier panics.

promisedIdi32required

The stream reserved for the push, 1 to 2^31 − 1; 0 or a negative identifier panics.

srcu8[]required

The buffer holding the fragment; copied, not kept.

offi32required

Where the fragment starts in src.

leni32required

The fragment's length in bytes; [off, off + len) outside src panics, and so does a payload past 2^24 − 1 bytes. Keeping it within the peer's SETTINGS_MAX_FRAME_SIZE is the caller's.

flagsi32required

H2_FLAG_END_HEADERS or 0; any other bit is dropped.

padi32required

Bytes of zero padding, 0 to 255, or -1 (any negative) for none; past 255 panics. PADDED is set from it, never from flags.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteRstStream

Writes a RST_STREAM frame closing streamId with code (§6.4).

const http2WriteRstStream: (
  out: u8[],
  at: i32,
  streamId: i32,
  code: i64,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream to close, 1 to 2^31 − 1; 0 or a negative identifier panics.

codei64required

The error code, an H2_* of §7 or another 32-bit value; only its low 32 bits are sent.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteSettings

Writes a SETTINGS frame of the settings ids[k] = values[k] (§6.5). A value http2SettingError refuses panics, as two lists of different lengths do.

const http2WriteSettings: (
  out: u8[],
  at: i32,
  ids: i32[],
  values: i64[],
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

idsi32[]required

The settings' identifiers, each 0 to 65,535, in the order sent; read, not kept.

valuesi64[]required

The settings' values, values[k] for ids[k], each 0 to 2^32 − 1; read, not kept.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteSettingsAck

Writes the empty SETTINGS frame with ACK that acknowledges the peer's (§6.5.3).

const http2WriteSettingsAck: (out: u8[], at: i32) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

http2WriteWindowUpdate

Writes a WINDOW_UPDATE frame adding increment, 1 to 2^31 − 1, to streamId's window, or the connection's for 0 (§6.9).

const http2WriteWindowUpdate: (
  out: u8[],
  at: i32,
  streamId: i32,
  increment: i32,
) => i32
outu8[]required

The buffer the frame is written into.

ati32required

Where the frame starts in out; a negative offset panics.

streamIdi32required

The stream whose window widens, or 0 for the connection's; a negative one panics.

incrementi32required

The bytes added to the window, 1 to 2^31 − 1; below 1 panics.

returnsi32

The offset just past the frame in out, or -1 when it would not fit, out then unchanged.

Classes

Http2Frame

One frame, as http2ReadHeader and http2ParseFrame read it. The next header read overwrites the header's fields; the next parse overwrites the content window, the padding and priority fields and streamError, and a type's own fields when it parses that type. A field only another type carries (errorCode, lastStreamId, increment, promisedId) keeps its last value, so a reader reads the fields of the type it parsed. One frame serves a whole connection.

class Http2Frame
Member
new Http2Frame()
contentLength: i32 The content's length in bytes, from contentStart. For every type but DATA, HEADERS, PUSH_PROMISE and GOAWAY, the window is the whole payload.
contentStart: i32 The frame's content, [contentStart, contentStart + contentLength) of the buffer: DATA's data, a header block fragment, PING's eight bytes, GOAWAY's debug data, SETTINGS' settings; padding and fixed fields left out.
dependency: i32 The stream this one depends on, the exclusive bit dropped; 0 without priority fields.
errorCode: i64 RST_STREAM's and GOAWAY's error code, a 32-bit value.
exclusive: boolean Whether the stream dependency is exclusive (§5.3.1); false without priority fields.
flags: i32 The flags byte from the header, as sent, bits a type does not define included; has tests one.
hasPriority: boolean Whether a HEADERS frame carried the PRIORITY fields, as a PRIORITY frame always does.
increment: i32 WINDOW_UPDATE's increment.
lastStreamId: i32 GOAWAY's last stream identifier.
length: i32 The payload's length, from the header.
padLength: i32 The Pad Length field, or -1 without PADDED.
promisedId: i32 PUSH_PROMISE's promised stream identifier.
streamError: i32 A stream error the frame is, or 0: the stream is reset and the connection lives.
streamId: i32 The stream identifier, the reserved bit dropped.
type: i32 The frame type from the header, 0 to 255: an H2_FRAME_*, or a type this module does not know.
weight: i32 The weight, 1 to 256.
has(bit: i32): boolean Whether the flag bit is set.

Limits

2,147,483,647

H2_MAX_WINDOW: i32

The largest a window may reach, and the largest INITIAL_WINDOW_SIZE: 2^31 − 1 bytes (§6.9.1).

Constants

8

H2_CANCEL: i32

CANCEL (0x8): the stream is no longer needed (§7).

9

H2_COMPRESSION_ERROR: i32

COMPRESSION_ERROR (0x9): the field-compression context cannot be kept (§7).

10

H2_CONNECT_ERROR: i32

CONNECT_ERROR (0xa): the connection a CONNECT request made was reset or closed (§7).

16,384

H2_DEFAULT_MAX_FRAME: i32

SETTINGS_MAX_FRAME_SIZE's initial value, which is also its least: 2^14 bytes (§6.5.2).

65,535

H2_DEFAULT_WINDOW: i32

A window's initial size, 65,535 bytes, on the connection and on every stream (§6.9.2).

11

H2_ENHANCE_YOUR_CALM: i32

ENHANCE_YOUR_CALM (0xb): the peer is generating excessive load (§7).

1

H2_FLAG_ACK: i32

ACK (0x1) on SETTINGS and PING, the same bit as END_STREAM: the frame acknowledges the peer's.

4

H2_FLAG_END_HEADERS: i32

END_HEADERS on HEADERS, PUSH_PROMISE and CONTINUATION.

1

H2_FLAG_END_STREAM: i32

END_STREAM (0x1) on DATA and HEADERS: the sender's last frame on the stream.

8

H2_FLAG_PADDED: i32

PADDED on DATA, HEADERS and PUSH_PROMISE.

32

H2_FLAG_PRIORITY: i32

PRIORITY on HEADERS.

3

H2_FLOW_CONTROL_ERROR: i32

FLOW_CONTROL_ERROR (0x3): the peer broke flow control (§7).

9

H2_FRAME_CONTINUATION: i32

CONTINUATION (0x9): the next fragment of a header block a HEADERS or PUSH_PROMISE began (§6.10).

0

H2_FRAME_DATA: i32

The frame types of §6, the header's type byte. DATA (0x0): a stream's body bytes (§6.1).

7

H2_FRAME_GOAWAY: i32

GOAWAY (0x7): the sender is going away; names the last stream it may have processed (§6.8).

1

H2_FRAME_HEADERS: i32

HEADERS (0x1): opens a stream with a header block fragment, or carries trailers (§6.2).

9

H2_FRAME_HEADER_SIZE: i32

The size of a frame header: a 24-bit length, a type, flags and a 31-bit stream identifier (§4.1).

6

H2_FRAME_PING: i32

PING (0x6): eight opaque bytes the peer echoes back with ACK (§6.7).

2

H2_FRAME_PRIORITY: i32

PRIORITY (0x2): a stream's dependency and weight, a scheme RFC 9113 deprecates (§6.3, §5.3.2).

5

H2_FRAME_PUSH_PROMISE: i32

PUSH_PROMISE (0x5): reserves a stream for a server push, with its request's header block (§6.6).

3

H2_FRAME_RST_STREAM: i32

RST_STREAM (0x3): ends one stream at once with an error code (§6.4).

4

H2_FRAME_SETTINGS: i32

SETTINGS (0x4): the sender's settings, or with ACK their acknowledgement (§6.5).

6

H2_FRAME_SIZE_ERROR: i32

FRAME_SIZE_ERROR (0x6): a frame had an invalid size (§7).

8

H2_FRAME_WINDOW_UPDATE: i32

WINDOW_UPDATE (0x8): widens a stream's or the connection's flow-control window (§6.9).

13

H2_HTTP_1_1_REQUIRED: i32

HTTP_1_1_REQUIRED (0xd): the endpoint requires HTTP/1.1 instead of HTTP/2 (§7).

12

H2_INADEQUATE_SECURITY: i32

INADEQUATE_SECURITY (0xc): the transport does not meet the minimum security requirements (§7).

2

H2_INTERNAL_ERROR: i32

INTERNAL_ERROR (0x2): the sender hit an unexpected internal error (§7).

16,777,215

H2_MAX_FRAME_LIMIT: i32

SETTINGS_MAX_FRAME_SIZE's greatest value, 2^24 − 1 bytes; a writer panics past it (§6.5.2).

0

H2_NO_ERROR: i32

The error codes of §7. NO_ERROR (0x0): not an error, as in a graceful GOAWAY; the parsers' "accepted".

1

H2_PROTOCOL_ERROR: i32

PROTOCOL_ERROR (0x1): a generic protocol violation (§7).

7

H2_REFUSED_STREAM: i32

REFUSED_STREAM (0x7): the stream was refused before any of it was processed; it may be retried (§7).

8

H2_SETTINGS_ENABLE_CONNECT_PROTOCOL: i32

SETTINGS_ENABLE_CONNECT_PROTOCOL (0x8): 0 or 1, whether the sender takes extended CONNECT (RFC 8441).

2

H2_SETTINGS_ENABLE_PUSH: i32

SETTINGS_ENABLE_PUSH (0x2): 0 or 1, whether the sender allows server push.

1

H2_SETTINGS_HEADER_TABLE_SIZE: i32

The settings of §6.5.2, and RFC 8441's, by identifier. SETTINGS_HEADER_TABLE_SIZE (0x1): the most bytes of HPACK dynamic table the sender lets its peer's encoder use.

4

H2_SETTINGS_INITIAL_WINDOW_SIZE: i32

SETTINGS_INITIAL_WINDOW_SIZE (0x4): every stream's initial send window, in bytes, 0 to 2^31 − 1.

3

H2_SETTINGS_MAX_CONCURRENT_STREAMS: i32

SETTINGS_MAX_CONCURRENT_STREAMS (0x3): the most streams the sender lets its peer open at once.

5

H2_SETTINGS_MAX_FRAME_SIZE: i32

SETTINGS_MAX_FRAME_SIZE (0x5): the longest frame payload the sender takes, 2^14 to 2^24 − 1 bytes.

6

H2_SETTINGS_MAX_HEADER_LIST_SIZE: i32

SETTINGS_MAX_HEADER_LIST_SIZE (0x6): advisory, the largest field section the sender takes (§6.5.2).

4

H2_SETTINGS_TIMEOUT: i32

SETTINGS_TIMEOUT (0x4): a SETTINGS was not acknowledged in time (§7).

6

H2_SETTING_SIZE: i32

The size of one setting: a 16-bit identifier and a 32-bit value.

5

H2_STREAM_CLOSED: i32

STREAM_CLOSED (0x5): a frame arrived on a stream that was half-closed for it (§7).