#[non_exhaustive]#[repr(u8)]pub enum ErrorKind {
Show 49 variants
Empty = 0,
NotToken = 1,
InvalidByte = 2,
BareCr = 3,
LineFeed = 4,
Nul = 5,
Control = 6,
UnterminatedQuote = 7,
InvalidQuotedPair = 8,
UnbalancedComment = 9,
CommentTooDeep = 10,
TooManyMembers = 11,
TooManyEmptyElements = 12,
TrailingSeparator = 13,
ExpectedSeparator = 14,
TrailingData = 15,
DuplicateParameter = 16,
MissingValue = 17,
InvalidNumber = 18,
NumberOverflow = 19,
OutOfRange = 20,
InvalidDate = 21,
WeekdayMismatch = 22,
InvalidMediaType = 23,
Wildcard = 24,
InvalidBoundary = 25,
InvalidQValue = 26,
InvalidEntityTag = 27,
InvalidRange = 28,
InvalidCharset = 29,
UnsupportedCharset = 30,
InvalidPercentEncoding = 31,
InvalidUtf8 = 32,
ControlInDecoded = 33,
InvalidHost = 34,
InvalidPort = 35,
InvalidAddress = 36,
InvalidOrigin = 37,
InvalidKey = 38,
TooLong = 39,
InvalidBase64 = 40,
InvalidEncodedWord = 41,
SectionGap = 42,
TooManySections = 43,
InvalidAddrSpec = 44,
LineTooLong = 45,
Malformed = 46,
TooManyHops = 47,
BufferTooSmall = 48,
}Expand description
What a parser refused.
Every variant names what was refused. Unless a variant says otherwise, the caller’s response is the same: treat the field as malformed. For a request field that means refusing the request (HTTP 400) or ignoring the field where its RFC allows that; for a field a server produced, it means a bug in the producer.
The enum is #[non_exhaustive]: new kinds may be added in minor versions.
§Examples
use parse_net::{scan, ErrorKind};
let err = scan::check_field_value(b"a\rb").unwrap_err();
assert_eq!(err.kind(), ErrorKind::BareCr);
assert_eq!(ErrorKind::BareCr.message(), "bare CR");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty = 0
A value or element that must not be empty was empty.
NotToken = 1
Bytes that must form a token (RFC 9110 section 5.6.2) do not.
InvalidByte = 2
A byte not allowed at this position.
BareCr = 3
A CR byte. CR is a request-smuggling vector: refuse the whole message, do not just drop the field.
LineFeed = 4
An LF byte inside a value. Refuse the whole message.
Nul = 5
A NUL byte. Refuse the whole message.
Control = 6
Another control byte (0x01 to 0x1F except HTAB, or DEL).
UnterminatedQuote = 7
A quoted string with no closing ", or one that would have to
continue on the next field line.
InvalidQuotedPair = 8
The byte after \ in a quoted string is not HTAB / SP / VCHAR / obs-text.
UnbalancedComment = 9
A ( without its ), or a ) without its (.
CommentTooDeep = 10
Comment nesting deeper than Limits::max_comment_depth.
TooManyMembers = 11
More list members, parameters, dictionary members, or encoded words than the configured limit allows.
TooManyEmptyElements = 12
More empty list elements (a, , , b) than
Limits::max_empty_elements.
TrailingSeparator = 13
A separator with nothing after it where the grammar forbids that.
ExpectedSeparator = 14
Two members without the separator between them.
TrailingData = 15
Bytes after a complete value.
DuplicateParameter = 16
A parameter name repeated where repetition is refused.
MissingValue = 17
A name without =value where a value is required.
InvalidNumber = 18
Digits were expected; a sign, space, or other byte was found.
NumberOverflow = 19
A number larger than its type or the RFC allows.
OutOfRange = 20
A value outside its valid range, such as a year outside 1 to 9999.
InvalidDate = 21
A date that does not exist, or that matches no accepted format.
WeekdayMismatch = 22
The weekday does not agree with the date.
InvalidMediaType = 23
A media type that does not match type "/" subtype parameters.
Wildcard = 24
* as a type or subtype where a concrete media type is required.
InvalidBoundary = 25
A boundary parameter that breaks RFC 2046 section 5.1.1.
InvalidQValue = 26
A q value outside the RFC 9110 section 12.4.2 grammar.
InvalidEntityTag = 27
An entity tag outside [ "W/" ] DQUOTE *etagc DQUOTE.
InvalidRange = 28
A range set or Content-Range that is malformed or inconsistent.
InvalidCharset = 29
A malformed charset name.
UnsupportedCharset = 30
A well-formed charset that parse-net does not decode. Only UTF-8, US-ASCII, and ISO-8859-1 are decoded.
InvalidPercentEncoding = 31
A % not followed by two hex digits, or uppercase hex where only
lowercase is allowed.
InvalidUtf8 = 32
Bytes that must be UTF-8 are not (overlong forms and surrogates included).
ControlInDecoded = 33
A decoded value contains a control byte. Never copy such a value into another header or a log.
InvalidHost = 34
A host that is not a reg-name, IPv4 address, or IP literal, or that
carries userinfo (@).
InvalidPort = 35
A port that is not digits, or is above 65535.
InvalidAddress = 36
An IP literal that is not a valid address, or a name made only of digits and dots that is not a valid IPv4 address.
InvalidOrigin = 37
An Origin that is not null or scheme "://" host [ ":" port ].
InvalidKey = 38
A Structured Field key outside ( lcalpha / "*" ) *( lcalpha / DIGIT / "_" / "-" / "." / "*" ).
TooLong = 39
A string, token, key, byte sequence, address, or local part longer than its limit.
InvalidBase64 = 40
Bytes outside the base64 alphabet, or a misplaced =.
InvalidEncodedWord = 41
A malformed RFC 2047 encoded word.
SectionGap = 42
RFC 2231 sections that are missing, repeated, or out of order, or a charset on a section other than 0.
TooManySections = 43
More RFC 2231 sections than
Limits::max_rfc2231_sections.
InvalidAddrSpec = 44
An address outside the strict RFC 5322 addr-spec.
LineTooLong = 45
An email header line over 998 bytes.
Malformed = 46
A structure that is wrong as a whole. For a forwarded chain, use the peer address.
TooManyHops = 47
A forwarded chain longer than the hop limit. Use the peer address.
BufferTooSmall = 48
The output buffer is shorter than the decoded value. Nothing was
written; retry with a buffer of the size the matching *_len function
reports.