masque_errors (masque v0.7.0)

View Source

RFC 9298 error to HTTP status code mapping.

All MASQUE failures reported during the CONNECT-UDP handshake must be returned to the client as an HTTP status response. This module centralises the mapping so server code and tests agree on the exact status code for each failure mode.

Summary

Functions

Map a handshake error to the status code MASQUE should return.

Short human-readable reason-phrase for the given error.

Types

handshake_error/0

-type handshake_error() ::
          bad_method | bad_protocol | bad_path | bad_port | bad_host | resolution_failed |
          upstream_timeout | forbidden | loop_detected | overload |
          {other, 400..599}.

Functions

handshake_status(_)

-spec handshake_status(handshake_error()) -> 400..599.

Map a handshake error to the status code MASQUE should return.

status_reason(_)

-spec status_reason(handshake_error()) -> binary().

Short human-readable reason-phrase for the given error.