pub struct H2Limits {
pub max_header_list_size: usize,
pub max_header_count: usize,
pub max_header_value_size: usize,
pub max_table_size: usize,
pub max_concurrent_streams: usize,
pub stream_timeout_ns: u64,
pub max_body_size: usize,
pub max_buffer_size: usize,
}Expand description
Configurable limits for HTTP/2 header decoding and stream management.
These limits defend against resource exhaustion from untrusted input (e.g., HPACK decompression bombs, stream flooding).
Fields§
§max_header_list_size: usizeMaximum total decoded header list size in bytes (default: 65536, RFC 7540 default)
max_header_count: usizeMaximum number of headers per HEADERS block (default: 128)
max_header_value_size: usizeMaximum size of any individual header value in bytes (default: 8192)
max_table_size: usizeHard cap for HPACK dynamic table size (default: 65536)
max_concurrent_streams: usizeMaximum concurrent active streams before rejecting new ones (default: 100)
stream_timeout_ns: u64Stream timeout in nanoseconds — streams older than this are evicted (default: 30s)
max_body_size: usizeMaximum accumulated body size per stream in bytes (default: 10 MiB). Streams exceeding this limit are dropped to prevent memory exhaustion.
max_buffer_size: usizeMaximum buffer size for incremental parsing in bytes. Rejects data that would grow the internal buffer beyond this limit. Default: 1 MiB. This bounds per-connection memory while allowing normal TCP read sizes and multi-frame chunks to be fed at once.