pub struct Http2Options { /* private fields */ }h2 only.Expand description
Configuration options for the HTTP/2 connection handler.
Use the builder-style methods to customise behaviour, then pass the finished
value to Http2::new.
§Examples
let options = Http2Options::default()
.handshake_timeout(Some(std::time::Duration::from_secs(10)))
.accept_timeout(Some(std::time::Duration::from_secs(60)));Implementations§
Source§impl Http2Options
impl Http2Options
Sourcepub fn new(h2: Builder) -> Self
pub fn new(h2: Builder) -> Self
Creates a new Http2Options from an h2 server builder with the
following defaults:
| Option | Default |
|---|---|
accept_timeout | 30 seconds |
handshake_timeout | 30 seconds |
send_continue_response | true |
send_date_header | true |
The h2 builder is used as-is and is not modified by this method.
Sourcepub fn h2_builder(&mut self) -> &mut Builder
pub fn h2_builder(&mut self) -> &mut Builder
Returns a mutable reference to the underlying h2::server::Builder.
Use this to tune HTTP/2 protocol settings such as flow-control windows, frame size limits, and header list size.
Sourcepub fn accept_timeout(self, timeout: Option<Duration>) -> Self
pub fn accept_timeout(self, timeout: Option<Duration>) -> Self
Sets the timeout for waiting on the next accepted HTTP/2 stream.
If no new stream arrives before this duration, the connection is
gracefully shut down and the handler returns a timeout error.
Pass None to disable this timeout. Defaults to 30 seconds.
Sourcepub fn handshake_timeout(self, timeout: Option<Duration>) -> Self
pub fn handshake_timeout(self, timeout: Option<Duration>) -> Self
Sets the timeout for the initial HTTP/2 handshake.
If the handshake does not complete within this duration, the handler
returns an I/O timeout error. Pass None to disable this timeout.
Defaults to 30 seconds.
Sourcepub fn send_continue_response(self, send: bool) -> Self
pub fn send_continue_response(self, send: bool) -> Self
Controls whether a 100 Continue interim response is sent when a
request contains an Expect: 100-continue header.
Defaults to true.
Sourcepub fn send_date_header(self, send: bool) -> Self
pub fn send_date_header(self, send: bool) -> Self
Controls whether a Date header is automatically added to every
response.
The value is cached and refreshed at most once per second.
Defaults to true.
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