h1_error (h1 v0.2.0)
View SourceHTTP/1.1 error reason classification.
H1 has no on-the-wire error code frame (unlike H2's RST_STREAM), so this module normalises the reason atoms the parser, connection, and encoder produce. Callers can map them to HTTP status codes or log messages via format/1.
Summary
Functions
Coarse-grained classification for logging and handler dispatch.
Human-readable description of an error reason.
Suggested HTTP status code for a given error reason (server side).
Types
-type conn_reason() ::
request_timeout | idle_timeout | expect_timeout | peer_closed | upgrade_rejected |
keepalive_limit_reached | pipeline_disabled | goaway_sent.
-type parse_reason() ::
bad_request | line_too_long | invalid_method | invalid_uri | invalid_version |
invalid_header_name | invalid_header_value | header_name_too_long | header_value_too_long |
too_many_headers | invalid_chunk_size | chunk_size_too_long | chunk_too_large |
invalid_chunk_terminator | conflicting_framing | body_too_large | method_too_long |
uri_too_long.
-type reason() :: parse_reason() | conn_reason() | {closed, term()} | term().
Functions
-spec classify(reason()) -> parse_error | client_error | server_error | timeout | closed | other.
Coarse-grained classification for logging and handler dispatch.
Human-readable description of an error reason.
-spec status(reason()) -> 400..599.
Suggested HTTP status code for a given error reason (server side).