pub struct ServerTimeouts {
pub header_read: Option<Duration>,
pub body_read: Option<Duration>,
pub write: Option<Duration>,
pub idle_keepalive: Option<Duration>,
pub shutdown_drain: Option<Duration>,
}Expand description
Aggregated server deadlines applied per connection and for graceful shutdown.
header_read: max time to receive a full ICAP header block (CRLFCRLF) once the request has started arriving. Mitigates slowloris-style header attacks.body_read: max time budget for reading the encapsulated body of a single request (chunked decoding included).write: max time to write any single response chunk to the client.idle_keepalive: max time to wait for the first byte of the next request on a kept-alive connection (after the previous response was flushed). Used only for the leading read; once any bytes arrive,header_readgoverns the rest of the header block.shutdown_drain: max time to wait for in-flight requests to finish after a shutdown signal. If the deadline expires, the remaining connections are cancelled. WhenNonethe server waits indefinitely.
Fields§
§header_read: Option<Duration>§body_read: Option<Duration>§write: Option<Duration>§idle_keepalive: Option<Duration>§shutdown_drain: Option<Duration>Implementations§
Source§impl ServerTimeouts
impl ServerTimeouts
Sourcepub const fn with_header_read(self, dur: Duration) -> Self
pub const fn with_header_read(self, dur: Duration) -> Self
Set the header_read deadline.
Limits how long the server waits to receive a full ICAP header block
(CRLFCRLF) once the request has started arriving.
Sourcepub const fn with_body_read(self, dur: Duration) -> Self
pub const fn with_body_read(self, dur: Duration) -> Self
Set the body_read deadline.
Bounds the time budget for reading the encapsulated body of a single request, including chunked decoding.
Sourcepub const fn with_write(self, dur: Duration) -> Self
pub const fn with_write(self, dur: Duration) -> Self
Set the write deadline.
Bounds the time to write any single response chunk to the client.
Sourcepub const fn with_idle_keepalive(self, dur: Duration) -> Self
pub const fn with_idle_keepalive(self, dur: Duration) -> Self
Set the idle_keepalive deadline.
Bounds how long the server waits for the first byte of the next
request on a kept-alive connection after the previous response was
flushed. Once any byte arrives, with_header_read
governs the rest of the header block.
Sourcepub const fn with_shutdown_drain(self, dur: Duration) -> Self
pub const fn with_shutdown_drain(self, dur: Duration) -> Self
Set the shutdown_drain deadline.
Bounds how long the server waits for active connections to finish after a shutdown signal. Connections still in flight when the deadline expires are cancelled. When not set the drain waits indefinitely.
Trait Implementations§
Source§impl Clone for ServerTimeouts
impl Clone for ServerTimeouts
Source§fn clone(&self) -> ServerTimeouts
fn clone(&self) -> ServerTimeouts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more