Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 38 variants InvalidMethod, InvalidTarget, InvalidVersion, VersionNotSupported, RequestLineTooLong, HeadTooLarge, TooManyHeaders, HeaderLineTooLong, InvalidHeaderName, InvalidHeaderValue, WhitespaceBeforeColon, ObsFold, BareCr, BareLf, MissingHost, DuplicateHost, InvalidHost, TeWithContentLength, DuplicateContentLength, InvalidContentLength, InvalidTransferEncoding, ChunkedNotFinal, UnsupportedTransferCoding, TransferEncodingHttp10, BodyTooLarge, ExpectationFailed, DuplicateUpgrade, InvalidChunkSize, ChunkSizeOverflow, InvalidChunkExtension, ChunkLineTooLong, MissingChunkCrlf, TrailersTooLarge, ForbiddenTrailer, UnexpectedEof, InvalidStatus, InvalidReason, FramingHeader,
}
Expand description

Why a message was refused. Every error means the connection must close after the error response (if any) is sent.

Variants§

§

InvalidMethod

The method is empty or has a byte outside tchar, or is not followed by one SP.

§

InvalidTarget

The request target has a forbidden byte, bad percent-encoding, or the wrong form for the method.

§

InvalidVersion

The version is not HTTP/ digit . digit, or the start line has extra bytes.

§

VersionNotSupported

A well-formed version other than 1.0 and 1.1.

§

RequestLineTooLong

The request line passed Limits::max_request_line.

§

HeadTooLarge

The head passed Limits::max_head.

§

TooManyHeaders

More than Limits::max_headers fields, or more than the header storage holds.

§

HeaderLineTooLong

A header line passed Limits::max_header_line.

§

InvalidHeaderName

A field name is empty or has a byte outside tchar.

§

InvalidHeaderValue

A field value has a control byte other than HTAB.

§

WhitespaceBeforeColon

Whitespace between a field name and the colon (RFC 9112 §5.1).

§

ObsFold

A line starting with whitespace: obs-fold, or whitespace after the start line.

§

BareCr

CR not followed by LF.

§

BareLf

LF not preceded by CR.

§

MissingHost

An HTTP/1.1 request without Host.

§

DuplicateHost

More than one Host.

§

InvalidHost

A Host value that is not uri-host [":" port].

§

TeWithContentLength

Both Transfer-Encoding and Content-Length.

§

DuplicateContentLength

More than one Content-Length value, equal or not.

§

InvalidContentLength

A Content-Length that is not 1*DIGIT within 64 bits.

§

InvalidTransferEncoding

A malformed Transfer-Encoding list (empty elements, non-token codings, parameters).

§

ChunkedNotFinal

Transfer-Encoding whose final coding is not chunked, or chunked twice.

§

UnsupportedTransferCoding

Codings before the final chunked (they are not implemented).

§

TransferEncodingHttp10

Transfer-Encoding in an HTTP/1.0 request.

§

BodyTooLarge

The body passed Limits::max_body.

§

ExpectationFailed

An Expect value other than 100-continue.

§

DuplicateUpgrade

A duplicate Upgrade field.

§

InvalidChunkSize

A chunk size that is not 1*HEXDIG.

§

ChunkSizeOverflow

A chunk size beyond 64 bits.

§

InvalidChunkExtension

A chunk extension that breaks the RFC 9112 §7.1.1 grammar.

§

ChunkLineTooLong

A chunk-size line longer than Limits::max_chunk_line.

§

MissingChunkCrlf

Chunk data not followed by CRLF.

§

TrailersTooLarge

The trailer section passed Limits::max_trailers.

§

ForbiddenTrailer

A trailer field that may not be a trailer (Content-Length, Transfer-Encoding, Host).

§

UnexpectedEof

The connection closed inside a body.

§

InvalidStatus

A status code that is not three digits from 100 to 599.

§

InvalidReason

A reason phrase with a control byte.

§

FramingHeader

A writer was asked to emit Content-Length or Transfer-Encoding as a plain field; use the framing methods instead.

Implementations§

Source§

impl Error

Source

pub fn status(self) -> u16

The response status for this error, when it happens on a request.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Error

Source§

impl Debug for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Error

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Error

Source§

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.