Skip to main content

Http3Options

Struct Http3Options 

Source
pub struct Http3Options { /* private fields */ }
Available on crate feature h3 only.
Expand description

Configuration options for the HTTP/3 connection handler.

Use the builder-style methods to customise behaviour, then pass the finished value to Http3::new.

§Examples

let options = Http3Options::default()
    .handshake_timeout(Some(std::time::Duration::from_secs(10)))
    .accept_timeout(Some(std::time::Duration::from_secs(60)));

Implementations§

Source§

impl Http3Options

Source

pub fn new() -> Self

Creates a new Http3Options with the following defaults:

OptionDefault
accept_timeout30 seconds
handshake_timeout30 seconds
send_continue_responsetrue
send_date_headertrue
qpack_max_table_capacity0 (RFC 9204 default)
qpack_blocked_streams0 (RFC 9204 default)
max_field_section_size65,536
enable_connect_protocolfalse
max_local_error_reset_streams1024
max_pending_accept_reset_streams20

The QPACK/limit settings are advertised to the peer in this endpoint’s SETTINGS frame and bound its codecs: the decoder’s dynamic-table capacity and blocked-stream budget come from qpack_max_table_capacity and qpack_blocked_streams; the peer’s encoder is limited by them in turn. max_field_section_size bounds how large a field section this endpoint will accept.

Source

pub fn qpack_max_table_capacity(self, capacity: u64) -> Self

Sets the maximum dynamic-table capacity this endpoint will grant the peer’s QPACK encoder via SETTINGS_QPACK_MAX_TABLE_CAPACITY (RFC 9204 Section 5).

This is also the capacity this endpoint’s own QPACK decoder uses. It must not exceed 2^30 - 1. Defaults to 0 (no dynamic table).

Source

pub fn qpack_blocked_streams(self, max: u64) -> Self

Sets how many field sections this endpoint will keep blocked while waiting for dynamic-table entries via SETTINGS_QPACK_BLOCKED_STREAMS (RFC 9204 Section 5).

Defaults to 0.

Source

pub fn max_field_section_size(self, max: Option<u64>) -> Self

Sets the maximum field-section size this endpoint will accept via SETTINGS_MAX_FIELD_SECTION_SIZE (RFC 9114 Section 7.2.4.1).

Pass None for unlimited (the RFC default).

Source

pub fn enable_connect_protocol(self, enable: bool) -> Self

Advertises support for the Extended CONNECT method via SETTINGS_ENABLE_CONNECT_PROTOCOL (RFC 9114 Section 7.2.4.1).

Defaults to false.

Source

pub fn accept_timeout(self, timeout: Option<Duration>) -> Self

Sets the timeout for waiting on the next accepted HTTP/3 request resolver.

If no new request 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.

Source

pub fn handshake_timeout(self, timeout: Option<Duration>) -> Self

Sets the timeout for the initial HTTP/3 connection setup (QUIC handshake and stream setup).

If the setup does not complete within this duration, the handler returns an I/O timeout error. Pass None to disable this timeout. Defaults to 30 seconds.

Source

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.

Source

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.

Source

pub fn max_local_error_reset_streams(self, max: Option<usize>) -> Self

Sets the maximum number of RESET_STREAM frames this endpoint sends in response to protocol errors made by the peer across the lifetime of the connection (RFC 9114 Section 10.5): a peer that keeps sending malformed requests past this limit costs the connection rather than the stream, which is then closed with H3_EXCESSIVE_LOAD. None disables the limit. Defaults to Some(1024).

Source

pub fn max_pending_accept_reset_streams(self, max: Option<usize>) -> Self

Sets the maximum number of streams the peer opened and then terminated (RESET_STREAM or STOP_SENDING) before this endpoint accepted them (RFC 9114 Section 10.5): a peer that churns through streams without dispatching a single request exceeds this budget, and the connection is closed with H3_EXCESSIVE_LOAD. None disables the limit. Defaults to Some(20).

Trait Implementations§

Source§

impl Default for Http3Options

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more