pub fn parse_response(bytes: &[u8]) -> Result<HttpResponse, ParseError>Expand description
Parse a complete HTTP/1.1 response from bytes — the client-side mirror of
parse_request: same ParseError::Incomplete retry contract, same
MAX_BODY/MAX_HEADERS caps, same lowercased header keys, same
Transfer-Encoding rejection.
Framing symmetry decision: serialize_response always emits an
accurate Content-Length, so this parser has no read-to-end-of-input mode —
a missing Content-Length means an empty body (the exact mirror of
parse_request’s default of 0). That keeps Incomplete meaningful: torn
input is always distinguishable from a complete message rather than guessed
at EOF.
Response-specific strictness (the client consumes bytes from arbitrary
servers, so mis-framing here is the smuggling hazard): the status code must
be exactly three ASCII digits in 100–599 (the reason phrase may be empty or
absent and is dropped — the write side derives it from the code), repeated
Content-Length headers must agree (RFC 9110 §8.6), and a stray CR or LF
inside the status line or a header line is rejected.