pub struct Http3Options { /* private fields */ }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
impl Http3Options
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Http3Options with the following defaults:
| Option | Default |
|---|---|
accept_timeout | 30 seconds |
handshake_timeout | 30 seconds |
send_continue_response | true |
send_date_header | true |
qpack_max_table_capacity | 0 (RFC 9204 default) |
qpack_blocked_streams | 0 (RFC 9204 default) |
max_field_section_size | 65,536 |
enable_connect_protocol | false |
max_local_error_reset_streams | 1024 |
max_pending_accept_reset_streams | 20 |
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.
Sourcepub fn qpack_max_table_capacity(self, capacity: u64) -> Self
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).
Sourcepub fn qpack_blocked_streams(self, max: u64) -> Self
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.
Sourcepub fn max_field_section_size(self, max: Option<u64>) -> Self
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).
Sourcepub fn enable_connect_protocol(self, enable: bool) -> Self
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.
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/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.
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/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.
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.
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 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).
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 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).