pub struct Limits {
pub max_multibulk: usize,
pub max_bulk: usize,
pub max_inline: usize,
pub max_depth: usize,
}Expand description
The bounds the codec enforces, which are Redis’s bounds.
These are not tuning knobs, they are the difference between a protocol error and an allocation the size of whatever a stranger asked for. A count line saying two billion arguments has to be refused before anything is reserved for it, which is why the multibulk limit is checked against the parsed number and not against what arrives.
Fields§
§max_multibulk: usizeThe largest * count accepted. Redis’s PROTO_MAX_MULTIBULK.
max_bulk: usizeThe largest $ length accepted. Redis’s proto-max-bulk-len, which is
configurable there and so is configurable here.
max_inline: usizeThe longest an inline request or an unterminated count line may get
before it is refused. Redis’s PROTO_INLINE_MAX_SIZE.
max_depth: usizeHow deeply a reply may nest before the decoder gives up.
Redis has no equivalent because Redis never parses a reply. This exists
because the reply decoder recurses, and *1\r\n repeated a million
times would otherwise be a stack overflow rather than an error. There is
no legitimate reply anywhere near this deep.