Expand description
Why bytes were rejected, split by the direction that produced them.
DecodeErrorcomes from bytes a peer sent. Exactly one variant,DecodeError::Incomplete, is not a violation: a head, a chunk line or a frame may be split across reads, and asking for more octets is the normal answer.DecodeError::is_violationsays which is which, because the remedy differs: read again, or refuse the message.EncodeErrorcomes from our own side: a value the wire cannot carry, such as a field value holding a line feed, which a recipient would read as the start of another field. The encoders refuse rather than escape, because HTTP has no escaping mechanism for either.
The what of every variant names the rule that was broken in the words of
the RFC, so a library above can map it onto a status code or an error code
without parsing a message.
Enumsยง
- Decode
Error - Why bytes could not be decoded.
- Encode
Error - Why a value could not be encoded.