pub struct HttpServiceConfig<const HEADER_LIMIT: usize = DEFAULT_HEADER_LIMIT, const READ_BUF_LIMIT: usize = DEFAULT_READ_BUF_LIMIT, const WRITE_BUF_LIMIT: usize = DEFAULT_WRITE_BUF_LIMIT> { /* private fields */ }Implementations§
Source§impl<const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
impl<const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
Sourcepub const fn disable_vectored_write(self) -> Self
pub const fn disable_vectored_write(self) -> Self
Disable vectored write even when IO is able to perform it.
This is beneficial when dealing with small size of response body.
Sourcepub const fn keep_alive_timeout(self, dur: Duration) -> Self
pub const fn keep_alive_timeout(self, dur: Duration) -> Self
Define duration of how long an idle connection is kept alive.
connection have not done any IO after duration would be closed. IO operation can possibly result in reset of the duration.
Sourcepub const fn request_head_timeout(self, dur: Duration) -> Self
pub const fn request_head_timeout(self, dur: Duration) -> Self
Define duration of how long a connection must finish it’s request head transferring. starting from first byte(s) of current request(s) received from peer.
connection can not make a single request after duration would be closed.
Sourcepub const fn tls_accept_timeout(self, dur: Duration) -> Self
pub const fn tls_accept_timeout(self, dur: Duration) -> Self
Define duration of how long a connection must finish it’s tls handshake. (If tls is enabled)
Connection can not finish handshake after duration would be closed.
Sourcepub const fn max_read_buf_size<const READ_BUF_LIMIT_2: usize>(
self,
) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT_2, WRITE_BUF_LIMIT>
pub const fn max_read_buf_size<const READ_BUF_LIMIT_2: usize>( self, ) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT_2, WRITE_BUF_LIMIT>
Define max read buffer size for a connection.
See DEFAULT_READ_BUF_LIMIT for default value and behavior.
§Panics
Panics when READ_BUF_LIMIT_2 < 32 or when READ_BUF_LIMIT_2 < h2_max_frame_size + 9.
The read buffer must be large enough to hold a full HTTP/2 frame (max payload + 9 byte
header), otherwise the dispatcher would deadlock waiting for a frame that can never fit.
When called in a const context (e.g. const CFG: _ = HttpServiceConfig::new()...)
a violation is reported as a compile-time error instead of a runtime panic.
Sourcepub const fn max_write_buf_size<const WRITE_BUF_LIMIT_2: usize>(
self,
) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT_2>
pub const fn max_write_buf_size<const WRITE_BUF_LIMIT_2: usize>( self, ) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT_2>
Define max write buffer size for a connection.
See DEFAULT_WRITE_BUF_LIMIT for default value and behavior.
Sourcepub const fn max_request_headers<const HEADER_LIMIT_2: usize>(
self,
) -> HttpServiceConfig<HEADER_LIMIT_2, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
pub const fn max_request_headers<const HEADER_LIMIT_2: usize>( self, ) -> HttpServiceConfig<HEADER_LIMIT_2, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
Define max request header count for a connection.
See DEFAULT_HEADER_LIMIT for default value and behavior.
Sourcepub const fn h2_max_concurrent_streams(self, val: u32) -> Self
pub const fn h2_max_concurrent_streams(self, val: u32) -> Self
Define the maximum number of concurrent HTTP/2 streams per connection.
Sourcepub const fn h2_initial_window_size(self, val: u32) -> Self
pub const fn h2_initial_window_size(self, val: u32) -> Self
Define the initial flow-control window size for HTTP/2 streams.
Must not exceed 2^31-1 (2,147,483,647).
Sourcepub const fn h2_max_frame_size(self, val: u32) -> Self
pub const fn h2_max_frame_size(self, val: u32) -> Self
Define the maximum HTTP/2 frame size the server is willing to receive.
Must be between 16,384 and 16,777,215 (inclusive).
§Panics
Panics when READ_BUF_LIMIT < val + 9. The read buffer must be large enough to hold
a full HTTP/2 frame (payload + 9 byte header), otherwise the dispatcher would deadlock
waiting for a frame that can never fit. Raise the read buffer first via
max_read_buf_size when increasing the frame size.
When called in a const context (e.g. const CFG: _ = HttpServiceConfig::new()...)
a violation is reported as a compile-time error instead of a runtime panic.
Sourcepub const fn h2_max_header_list_size(self, val: u32) -> Self
pub const fn h2_max_header_list_size(self, val: u32) -> Self
Define the maximum size of HTTP/2 header list the server is willing to accept.
Sourcepub const fn peek_protocol(self) -> Self
pub const fn peek_protocol(self) -> Self
Enable peek into connection to figure out it’s protocol regardless the outcome of alpn negotiation.
This API is used to bypass alpn setting from tls and enable Http/2 protocol over plain Tcp connection.
Trait Implementations§
Source§impl<const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> Clone for HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
impl<const HEADER_LIMIT: usize, const READ_BUF_LIMIT: usize, const WRITE_BUF_LIMIT: usize> Clone for HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
Source§fn clone(
&self,
) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
fn clone( &self, ) -> HttpServiceConfig<HEADER_LIMIT, READ_BUF_LIMIT, WRITE_BUF_LIMIT>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more