Skip to main content

DEFAULT_MAX_MESSAGE_LEN

Constant DEFAULT_MAX_MESSAGE_LEN 

Source
pub const DEFAULT_MAX_MESSAGE_LEN: usize = _ /* 134_217_728usize */;
Expand description

Default largest accepted length for a single backend message body, in bytes (128 MiB).

A server (or a man in the middle, since sslmode=require does not authenticate the server) can otherwise make the client buffer up to 2 GiB while waiting for a message that will never arrive. The limit is checked before anything is buffered, so a hostile length fails immediately.

This can be raised or lowered per connection with decode_with_limit; see crate::error callers. 128 MiB is large enough for any realistic row while keeping the worst-case buffering bounded.