Struct HeaderReadTimeout
pub struct HeaderReadTimeout {
pub grace: Duration,
pub min_rate: u32,
pub ceiling: Duration,
}http-backend and http and std only.Expand description
Deadline for receiving a complete request head, measured from its first byte.
A head is never cut within grace. After that it is cut as soon
as the average rate at which its bytes arrived, counted from its first byte,
falls below min_rate, so a slow but progressing client keeps
going while a trickle is cut. A head still incomplete at
ceiling is cut whatever its rate.
HTTP/1 closes the connection; HTTP/2 sends GOAWAY with ENHANCE_YOUR_CALM
and closes it, as an open header block stalls the whole connection; HTTP/3
resets only that request stream with H3_REQUEST_REJECTED, which tells the
client it may retry, unless the connection never received a complete head,
in which case it also closes the connection gracefully.
Fields§
§grace: DurationNever cut a head within this window after its first byte.
Extended by four round trips, at most doubled, when the connection measured its round-trip time.
min_rate: u32After the grace window, cut a head whose average arrival rate is below this many bytes per second. Zero disables the rate rule.
ceiling: DurationCut a head still incomplete after this long, whatever its rate.
Implementations§
§impl HeaderReadTimeout
impl HeaderReadTimeout
pub const DEFAULT: HeaderReadTimeout
pub const DEFAULT: HeaderReadTimeout
10 s of grace, a floor of 256 bytes per second, and a 60 s ceiling.
Ten seconds absorbs a few lost-segment retransmissions. 256 B/s lets a 2.5 KiB head through within the grace window and is far above what a trickling attacker sends, yet far below any working link. Established servers cap header reads at 60 s.
Trait Implementations§
§impl Clone for HeaderReadTimeout
impl Clone for HeaderReadTimeout
§fn clone(&self) -> HeaderReadTimeout
fn clone(&self) -> HeaderReadTimeout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HeaderReadTimeout
§impl Debug for HeaderReadTimeout
impl Debug for HeaderReadTimeout
§impl Default for HeaderReadTimeout
impl Default for HeaderReadTimeout
§fn default() -> HeaderReadTimeout
fn default() -> HeaderReadTimeout
impl Eq for HeaderReadTimeout
§impl PartialEq for HeaderReadTimeout
impl PartialEq for HeaderReadTimeout
impl StructuralPartialEq for HeaderReadTimeout
Auto Trait Implementations§
impl Freeze for HeaderReadTimeout
impl RefUnwindSafe for HeaderReadTimeout
impl Send for HeaderReadTimeout
impl Sync for HeaderReadTimeout
impl Unpin for HeaderReadTimeout
impl UnsafeUnpin for HeaderReadTimeout
impl UnwindSafe for HeaderReadTimeout
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§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