Why the parser refused a message, one value per rule it enforces. The comments give the status a server answers with
(error_status returns the same number). The kind is in Parser.error after an .ERROR event, and a failed parser stays failed.
parser: Parser;
parser_init(*parser, .REQUEST);
defer parser_free(*parser);
// An HTTP/1.1 request without a Host header.
text := "GET / HTTP/1.1\r\n\r\n";
_, event := parse(*parser, .{ text.count, text.data });
assert(event.kind == .ERROR);
assert(parser.error.kind == .MISSING_HOST);
assert(error_status(parser.error.kind) == 400);Members
- NONE
- BAD_START_LINE
- 400: not
METHOD target HTTP/1.x(or a status line) - BAD_METHOD
- 400
- BAD_TARGET
- 400: bytes a target may not hold, or a form the method does not allow
- BAD_VERSION
- 400: not shaped like HTTP/d.d
- VERSION_NOT_SUPPORTED
- 505: HTTP/0.9, HTTP/2, HTTP/1.2...
- BAD_STATUS
- 400: a response status that is not 100-599
- BAD_LINE_ENDING
- 400: a bare LF, or a CR not followed by LF
- BAD_HEADER_NAME
- 400: not a token, or no colon
- WHITESPACE_BEFORE_COLON
- 400
- OBS_FOLD
- 400: a header line starting with SP or HTAB
- BAD_HEADER_VALUE
- 400: control bytes in a value
- MISSING_HOST
- 400: an HTTP/1.1 request without Host
- DUPLICATE_HOST
- 400
- BAD_CONTENT_LENGTH
- 400: not 1*DIGIT, or too big for 63 bits
- DUPLICATE_CONTENT_LENGTH
- 400
- CONTENT_LENGTH_WITH_TRANSFER_ENCODING
- 400: request smuggling
- BAD_TRANSFER_ENCODING
- 400: empty, repeated chunked, or chunked not last
- UNSUPPORTED_TRANSFER_ENCODING
- 501: gzip, deflate... around chunked
- BAD_EXPECT
- 417: an expectation other than 100-continue
- BAD_CHUNK
- 400: chunk size, extension or framing
- CHUNK_SIZE_OVERFLOW
- 400: more than 63 bits of chunk size
- BAD_TRAILER
- 400
- URI_TOO_LONG
- 414: the request line is over max_line_size
- HEADERS_TOO_LARGE
- 431: a header line or the head is over its limit
- TOO_MANY_HEADERS
- 431
- BODY_TOO_LARGE
- 413
- DATA_AFTER_CLOSE
- 400: bytes after a message that ends the connection
- UNEXPECTED_EOF
- 400: the connection closed inside a message