silk.http.http2_frame.
HTTP/2 wire frame headers, error codes, and frame serialization from RFC 9113.
Use FrameHeader.read after collecting nine bytes. A connection must enforce its negotiated
frame size and stream rules before it accepts the payload. Unknown frame types remain representable.
Import as FrameHeader with import silk.http.http2_frame { FrameHeader }.
Public declarations: 19.
preface#
pub fn preface() -> &'static [u8]Returns the client connection preface. The client sends SETTINGS immediately after these bytes.
NO_ERROR#
pub const NO_ERROR: u32Successful completion, wire error code 0.
PROTOCOL_ERROR#
pub const PROTOCOL_ERROR: u32A protocol rule violation, wire error code 1.
INTERNAL_ERROR#
pub const INTERNAL_ERROR: u32An implementation failure, wire error code 2.
FLOW_CONTROL_ERROR#
pub const FLOW_CONTROL_ERROR: u32A flow-control violation, wire error code 3.
SETTINGS_TIMEOUT#
pub const SETTINGS_TIMEOUT: u32A SETTINGS acknowledgment timeout, wire error code 4.
STREAM_CLOSED#
pub const STREAM_CLOSED: u32A frame on a closed stream, wire error code 5.
FRAME_SIZE_ERROR#
pub const FRAME_SIZE_ERROR: u32An invalid frame length, wire error code 6.
REFUSED_STREAM#
pub const REFUSED_STREAM: u32A request refused before processing, wire error code 7.
CANCEL#
pub const CANCEL: u32A cancelled stream, wire error code 8.
COMPRESSION_ERROR#
pub const COMPRESSION_ERROR: u32A malformed HPACK context, wire error code 9.
CONNECT_ERROR#
pub const CONNECT_ERROR: u32A failed CONNECT tunnel, wire error code 10.
ENHANCE_YOUR_CALM#
pub const ENHANCE_YOUR_CALM: u32A peer exceeded resource limits, wire error code 11.
INADEQUATE_SECURITY#
pub const INADEQUATE_SECURITY: u32The transport does not meet security requirements, wire error code 12.
HTTP_1_1_REQUIRED#
pub const HTTP_1_1_REQUIRED: u32The peer requires HTTP/1.1, wire error code 13.
ProtocolError#
pub struct ProtocolErrorAn HTTP/2 error. Stream zero identifies a connection error; a nonzero identifier identifies a stream error.
Field code#
pub code: u32The wire error code for GOAWAY or RST_STREAM.
Field stream#
pub stream: u32Zero for a connection error, otherwise the affected stream identifier.
Implementation Copy for ProtocolError#
impl Copy for ProtocolErrorImplementation Debug for ProtocolError#
impl Debug for ProtocolErrorOperation debug#
effect fn debug(self: &Self, formatter: &mut Formatter) -> () ! WriterError ? &mut WriterWrites the fields, as ProtocolError { code: ..., stream: ... }.
FrameHeader#
pub struct FrameHeaderThe nine-byte HTTP/2 frame header. The reserved stream bit is ignored when reading.
Field length#
pub length: usizePayload length, excluding the nine-byte header.
Field kind#
pub kind: u8The wire frame type, including extension types.
Field flags#
pub flags: u8Frame flags, including unknown flags that receivers ignore.
Field stream#
pub stream: u32The 31-bit stream identifier, or zero for a connection frame.
Implementation Copy for FrameHeader#
impl Copy for FrameHeaderImplementation FrameHeader#
impl FrameHeaderAssociated function read#
pub effect fn read(input: &[u8]) -> FrameHeader
! ProtocolErrorReads exactly nine header bytes. An incorrect input length fails with FRAME_SIZE_ERROR.
Method write#
pub effect fn write(self: &Self, output: &mut Bytes, payload: &[u8]) -> ()
! ProtocolError | OutOfMemoryError
? &mut AllocatorAppends this header and payload. Invalid payload length or stream bits fail before output changes.
read32#
pub fn read32(input: &[u8], offset: usize) -> u32Reads four network-order bytes. The caller must supply four bytes starting at offset.
write32#
pub effect fn write32(output: &mut Bytes, value: u32) -> ()
! OutOfMemoryError
? &mut AllocatorAppends four bytes in network order.
Category: HTTP.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.