Skip to main content

Module limits

Module limits 

Source
Expand description

The caller’s bounds, passed to every decode, and the numbers they default to.

HTTP sets no limit of its own on a head, a field count or a chunk line (RFC 9110 §5.4 lets a recipient refuse with 431 and says nothing about where): every bound is the recipient’s choice. So each is an argument, carried by value in Limits, and each is checked from what the peer declared or from how far the decoder has searched, before anything is reserved for it.

Four numbers, because a peer has four ways to make a decoder commit memory or time: a head (or a compressed field section) that never ends or expands without bound, a field section of unboundedly many tiny fields, a chunk-size line that never ends, and a frame whose length prefix announces megabytes.

Structs§

Limits
Bounds a decoder applies to remote input.

Constants§

DEFAULT_MAX_CHUNK_LINE
A starting value for Limits::max_chunk_line: 1 KiB.
DEFAULT_MAX_FIELDS
A starting value for Limits::max_fields: 128.
DEFAULT_MAX_FRAME_SIZE
A starting value for Limits::max_frame_size: 16 384, the HTTP/2 default and minimum of SETTINGS_MAX_FRAME_SIZE (RFC 9113 §6.5.2).
DEFAULT_MAX_HEAD_BYTES
A starting value for Limits::max_head_bytes: 64 KiB.