pub enum EscapeError {
ContainsCrlf,
ContainsNull,
ContainsTab,
ContainsNonPrintable(u8),
OversizeForBoundary(usize),
}Expand description
Reasons HeaderEscapeGuard::header_value rejects a string.
Each variant names the exact byte class that triggered the
rejection so the caller can build a useful 4xx / 500 response and
the audit log gets a structured diagnostic, not a hand-formatted
string. The byte payload on ContainsNonPrintable is the
offending byte itself, useful for debug logs and for tests
asserting the guard caught the right byte.
Variants§
ContainsCrlf
Value contained CR (\r) or LF (\n).
ContainsNull
Value contained NUL (\0).
ContainsTab
Value contained HTAB (\t).
ContainsNonPrintable(u8)
Value contained another non-printable ASCII byte (0x01–0x08, 0x0B, 0x0C, 0x0E–0x1F, or 0x7F). The payload is the offending byte for diagnostic clarity.
OversizeForBoundary(usize)
Value exceeds MAX_HEADER_VALUE_BYTES. The payload is the
observed length so the caller can include it in the error
reply.
Trait Implementations§
Source§impl Clone for EscapeError
impl Clone for EscapeError
Source§fn clone(&self) -> EscapeError
fn clone(&self) -> EscapeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EscapeError
impl Debug for EscapeError
Source§impl Display for EscapeError
impl Display for EscapeError
Source§impl Error for EscapeError
impl Error for EscapeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for EscapeError
impl PartialEq for EscapeError
Source§fn eq(&self, other: &EscapeError) -> bool
fn eq(&self, other: &EscapeError) -> bool
self and other values to be equal, and is used by ==.impl Copy for EscapeError
impl Eq for EscapeError
impl StructuralPartialEq for EscapeError
Auto Trait Implementations§
impl Freeze for EscapeError
impl RefUnwindSafe for EscapeError
impl Send for EscapeError
impl Sync for EscapeError
impl Unpin for EscapeError
impl UnsafeUnpin for EscapeError
impl UnwindSafe for EscapeError
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request