Struct Http2Builder
pub struct Http2Builder<'a> { /* private fields */ }
Expand description
Http2 part of builder.
Implementations§
§impl Http2Builder<'_>
impl Http2Builder<'_>
pub fn http1(&mut self) -> Http1Builder<'_>
pub fn http1(&mut self) -> Http1Builder<'_>
Http1 configuration.
pub fn max_pending_accept_reset_streams(
&mut self,
max: impl Into<Option<usize>>,
) -> &mut Http2Builder<'_>
pub fn max_pending_accept_reset_streams( &mut self, max: impl Into<Option<usize>>, ) -> &mut Http2Builder<'_>
Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent.
This will default to the default value set by the h2
crate.
As of v0.4.0, it is 20.
See https://github.com/hyperium/hyper/issues/2877 for more information.
pub fn max_local_error_reset_streams(
&mut self,
max: impl Into<Option<usize>>,
) -> &mut Http2Builder<'_>
pub fn max_local_error_reset_streams( &mut self, max: impl Into<Option<usize>>, ) -> &mut Http2Builder<'_>
Configures the maximum number of local reset streams allowed before a GOAWAY will be sent.
If not set, rama-http-core will use a default, currently of 1024.
If None
is supplied, rama-http-core will not apply any limit.
This is not advised, as it can potentially expose servers to DOS vulnerabilities.
See https://rustsec.org/advisories/RUSTSEC-2024-0003.html for more information.
pub fn initial_stream_window_size(
&mut self,
sz: impl Into<Option<u32>>,
) -> &mut Http2Builder<'_>
pub fn initial_stream_window_size( &mut self, sz: impl Into<Option<u32>>, ) -> &mut Http2Builder<'_>
Sets the SETTINGS_INITIAL_WINDOW_SIZE
option for HTTP2
stream-level flow control.
Passing None
will do nothing.
If not set, rama-http-core will use a default.
pub fn initial_connection_window_size(
&mut self,
sz: impl Into<Option<u32>>,
) -> &mut Http2Builder<'_>
pub fn initial_connection_window_size( &mut self, sz: impl Into<Option<u32>>, ) -> &mut Http2Builder<'_>
Sets the max connection-level flow control for HTTP2.
Passing None
will do nothing.
If not set, rama-http-core will use a default.
pub fn adaptive_window(&mut self, enabled: bool) -> &mut Http2Builder<'_>
pub fn adaptive_window(&mut self, enabled: bool) -> &mut Http2Builder<'_>
Sets whether to use an adaptive flow control.
Enabling this will override the limits set in
http2_initial_stream_window_size
and
http2_initial_connection_window_size
.
pub fn max_frame_size(
&mut self,
sz: impl Into<Option<u32>>,
) -> &mut Http2Builder<'_>
pub fn max_frame_size( &mut self, sz: impl Into<Option<u32>>, ) -> &mut Http2Builder<'_>
Sets the maximum frame size to use for HTTP2.
Passing None
will do nothing.
If not set, rama-http-core will use a default.
pub fn max_concurrent_streams(
&mut self,
max: impl Into<Option<u32>>,
) -> &mut Http2Builder<'_>
pub fn max_concurrent_streams( &mut self, max: impl Into<Option<u32>>, ) -> &mut Http2Builder<'_>
Sets the SETTINGS_MAX_CONCURRENT_STREAMS
option for HTTP2
connections.
Default is 200. Passing None
will remove any limit.
pub fn keep_alive_interval(
&mut self,
interval: impl Into<Option<Duration>>,
) -> &mut Http2Builder<'_>
pub fn keep_alive_interval( &mut self, interval: impl Into<Option<Duration>>, ) -> &mut Http2Builder<'_>
Sets an interval for HTTP2 Ping frames should be sent to keep a connection alive.
Pass None
to disable HTTP2 keep-alive.
Default is currently disabled.
§Cargo Feature
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Http2Builder<'_>
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Http2Builder<'_>
Sets a timeout for receiving an acknowledgement of the keep-alive ping.
If the ping is not acknowledged within the timeout, the connection will
be closed. Does nothing if http2_keep_alive_interval
is disabled.
Default is 20 seconds.
§Cargo Feature
pub fn max_send_buf_size(&mut self, max: usize) -> &mut Http2Builder<'_>
pub fn max_send_buf_size(&mut self, max: usize) -> &mut Http2Builder<'_>
Set the maximum write buffer size for each HTTP/2 stream.
Default is currently ~400KB, but may change.
§Panics
The value must be no larger than u32::MAX
.
pub fn enable_connect_protocol(&mut self) -> &mut Http2Builder<'_>
pub fn enable_connect_protocol(&mut self) -> &mut Http2Builder<'_>
Enables the extended CONNECT protocol.
pub fn max_header_list_size(&mut self, max: u32) -> &mut Http2Builder<'_>
pub fn max_header_list_size(&mut self, max: u32) -> &mut Http2Builder<'_>
Sets the max size of received header frames.
Default is currently ~16MB, but may change.
pub fn auto_date_header(&mut self, enabled: bool) -> &mut Http2Builder<'_>
pub fn auto_date_header(&mut self, enabled: bool) -> &mut Http2Builder<'_>
Set whether the date
header should be included in HTTP responses.
Note that including the date
header is recommended by RFC 7231.
Default is true.
pub async fn serve_connection<I, S>(
&self,
io: I,
service: S,
) -> Result<(), Box<dyn Error + Sync + Send>>
pub async fn serve_connection<I, S>( &self, io: I, service: S, ) -> Result<(), Box<dyn Error + Sync + Send>>
Bind a connection together with a [Service
].
pub fn serve_connection_with_upgrades<I, S>(
&self,
io: I,
service: S,
) -> UpgradeableConnection<'_, I, S> ⓘ
pub fn serve_connection_with_upgrades<I, S>( &self, io: I, service: S, ) -> UpgradeableConnection<'_, I, S> ⓘ
Bind a connection together with a [Service
], with the ability to
handle HTTP upgrades. This requires that the IO object implements
Send
.
Auto Trait Implementations§
impl<'a> Freeze for Http2Builder<'a>
impl<'a> RefUnwindSafe for Http2Builder<'a>
impl<'a> Send for Http2Builder<'a>
impl<'a> Sync for Http2Builder<'a>
impl<'a> Unpin for Http2Builder<'a>
impl<'a> !UnwindSafe for Http2Builder<'a>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy
that returns Action::Follow
only if self
and other
return
Action::Follow
. Read more