pub struct Http2Options { /* private fields */ }h2 only.Expand description
HTTP/2 server configuration.
Build one with Http2Options::default and override individual fields
with the builder methods, then hand it to Http2::new.
Unlike the framing/header limits below, the connection window settings
(initial_stream_window_size
and initial_connection_window_size)
are advisory: a client may shrink them with its own SETTINGS, and the
server honours the smaller value.
Implementations§
Source§impl Http2Options
impl Http2Options
Sourcepub fn handshake_timeout(self, handshake_timeout: Option<Duration>) -> Self
pub fn handshake_timeout(self, handshake_timeout: Option<Duration>) -> Self
Sets the maximum time to wait for a client to send the HTTP/2 preface before aborting the connection.
Sourcepub fn send_continue_response(self, send_continue_response: bool) -> Self
pub fn send_continue_response(self, send_continue_response: bool) -> Self
Sends 100 Continue responses automatically when a request has a body.
Defaults to true.
Sourcepub fn send_date_header(self, send_date_header: bool) -> Self
pub fn send_date_header(self, send_date_header: bool) -> Self
Inserts a Date header into responses that lack one.
Defaults to true.
Sourcepub fn max_concurrent_streams(self, max_concurrent_streams: u32) -> Self
pub fn max_concurrent_streams(self, max_concurrent_streams: u32) -> Self
Sets the maximum number of concurrent streams allowed on a connection.
Defaults to 200.
Sourcepub fn initial_stream_window_size(self, initial_stream_window_size: u32) -> Self
pub fn initial_stream_window_size(self, initial_stream_window_size: u32) -> Self
Sets the initial per-stream flow-control window size advertised to the
client. Defaults to 1_048_576.
Sourcepub fn initial_connection_window_size(
self,
initial_connection_window_size: u32,
) -> Self
pub fn initial_connection_window_size( self, initial_connection_window_size: u32, ) -> Self
Sets the initial connection-level flow-control window size.
Defaults to 1_048_576.
Sourcepub fn max_frame_size(self, max_frame_size: u32) -> Self
pub fn max_frame_size(self, max_frame_size: u32) -> Self
Sets the maximum frame size the server will send or receive.
Defaults to the RFC 9113 default (16_384); must not exceed
2^24 - 1.
Sourcepub fn max_header_list_size(self, max_header_list_size: u32) -> Self
pub fn max_header_list_size(self, max_header_list_size: u32) -> Self
Sets the maximum size of an uncompressed header list the server will
accept. Defaults to 16_384.
Sourcepub fn enable_connect_protocol(self, enable: bool) -> Self
pub fn enable_connect_protocol(self, enable: bool) -> Self
Sets whether to enable the Extended CONNECT protocol, allowing for
example for tunneling WebSockets over HTTP/2. Defaults to false.
Sourcepub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Self
pub fn idle_timeout(self, idle_timeout: Option<Duration>) -> Self
Sets the idle timeout: a connection that receives no frame from the
peer for this long is closed gracefully with a GOAWAY (RFC 9113
Section 10.5). Defaults to None (no idle timeout).
Sourcepub fn max_local_error_reset_streams(self, max: Option<usize>) -> Self
pub fn max_local_error_reset_streams(self, max: Option<usize>) -> Self
Sets the maximum number of RST_STREAM frames this endpoint sends in
response to protocol errors made by the peer across the lifetime of
the connection. When the peer keeps producing protocol errors past
this many local resets, the connection is closed with a GOAWAY of
type ENHANCE_YOUR_CALM (RFC 9113 Section 10.5.2). None disables
the limit. Defaults to Some(1024).
Sourcepub fn max_pending_accept_reset_streams(self, max: Option<usize>) -> Self
pub fn max_pending_accept_reset_streams(self, max: Option<usize>) -> Self
Sets the maximum number of streams the peer reset before this endpoint
accepted them (their request was never dispatched) that may be
counted at a time. When the peer keeps opening and resetting streams
faster than they are consumed, the connection is closed with a GOAWAY
of type ENHANCE_YOUR_CALM (RFC 9113 Section 10.5.2). None disables
the limit. Defaults to Some(20).
Sourcepub fn max_continuation_frames(self, max: Option<usize>) -> Self
pub fn max_continuation_frames(self, max: Option<usize>) -> Self
Sets the maximum number of frames that may compose a single header
field block that has not yet been terminated by END_HEADERS. A field
block is opened by a HEADERS (or PUSH_PROMISE) frame without
END_HEADERS and continued by CONTINUATION frames. When a peer keeps
one open past this many frames, it is a CONTINUATION flood and the
stream is reset with RST_STREAM PROTOCOL_ERROR.
None (the default) computes a safe bound automatically: the
configured max_header_list_size divided by max_frame_size,
plus a ~20% packing buffer and a fixed slack of 10 frames. This is
enough for any honestly-packed header block while catching floods
that never close the block.
Defaults to None.
Trait Implementations§
Source§impl Clone for Http2Options
impl Clone for Http2Options
Source§fn clone(&self) -> Http2Options
fn clone(&self) -> Http2Options
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more