Skip to main content

Http2Options

Struct Http2Options 

Source
pub struct Http2Options { /* private fields */ }
Available on crate feature 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

Source

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.

Source

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.

Source

pub fn send_date_header(self, send_date_header: bool) -> Self

Inserts a Date header into responses that lack one.

Defaults to true.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Trait Implementations§

Source§

impl Clone for Http2Options

Source§

fn clone(&self) -> Http2Options

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Http2Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Http2Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.