pub struct Http2Options { /* private fields */ }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
Available on crate feature h2 only.
pub fn new(h2: Builder) -> Self
h2 only.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 |
The h2 builder is used as-is and is not modified by this method.
Sourcepub fn h2_builder(&mut self) -> &mut Builder
Available on crate feature h2 only.
pub fn h2_builder(&mut self) -> &mut Builder
h2 only.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
Available on crate feature h2 only.
pub fn accept_timeout(self, timeout: Option<Duration>) -> Self
h2 only.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
Available on crate feature h2 only.
pub fn handshake_timeout(self, timeout: Option<Duration>) -> Self
h2 only.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
Available on crate feature h2 only.
pub fn send_continue_response(self, send: bool) -> Self
h2 only.Controls whether a 100 Continue interim response is sent when a
request contains an Expect: 100-continue header.
Defaults to true.
Trait Implementations§
Source§impl Clone for Http2Options
Available on crate feature h2 only.
impl Clone for Http2Options
h2 only.Source§fn clone(&self) -> Http2Options
fn clone(&self) -> Http2Options
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Http2Options
Available on crate feature h2 only.
impl Debug for Http2Options
h2 only.