HTTP Protocol Types
HTTP Value Types
Methods, Versions, and Statuses
HttpMethod stores any valid case-sensitive HTTP method token.
Canonical uppercase spellings of the common standard methods are classified with HttpMethodType and can be grouped
in HttpMethodTypes.
Extension methods retain their exact spelling and remain exactly comparable.
HttpVersion represents HTTP/1.0 and HTTP/1.1. HttpStatus accepts every numeric code from 100 through 599 and
provides named constants and conventional reason phrases for recognized codes.
Reason phrases are conveniences; the HTTP codec owns status-line syntax.
Media Types
HttpMediaType stores canonical lowercase type and subtype tokens plus ordered HttpMediaTypeParameter values.
Parameter names are case-insensitive and unique.
Parsing accepts token and quoted-string values, removes quoting and escapes, and canonical output quotes a semantic
value only when token syntax cannot represent it.
Header Fields
HttpFieldName retains the supplied ASCII spelling while comparison and hashing use ASCII case folding.
HttpFieldType recognizes the HTTP core fields plus Cookie and Set-Cookie; arbitrary extension names remain valid.
Request and response applicability is descriptive metadata, not a rejection rule.
HttpField keeps the exact supplied field value, including obs-text and malformed UTF-8 bytes.
Leading or trailing field-line optional whitespace (SP or HTAB), CR, LF, NUL, DEL, and other prohibited control bytes
are rejected at construction.
The HTTP codec removes field-line edge OWS before constructing this value; every interior byte is retained without UTF-8
validation, normalization, or transcoding.
HttpHeaders is an ordered copy-on-write field list.
Repeated fields remain separate and ordered.
Every mutation enforces captured HttpHeaderLimits and has a strong failure guarantee.
setField() replaces the first matching position, removes later duplicates, and appends only when the field was
absent.
The default limits are 100 fields, 256 bytes per name, 16 KiB per value, and 64 KiB aggregate serialized size.
Aggregate accounting uses the canonical name: value form plus CRLF for each field.
HTTP Messages and Codecs
Message-Head Values
HttpRequestHead and HttpResponseHead are validated, read-only message-head values.
A default-constructed value is an invalid placeholder.
A successful constructor validates the start-line components and all header fields.
A request head stores the method, exact printable-ASCII request target, HTTP version, and headers. A response head stores the HTTP version, status, exact reason phrase, and headers. Both HTTP/1.0 and HTTP/1.1 are supported.
Raw Field Semantics
HTTP field values are stored as String values without normalization or transcoding.
Parsing removes only field-line edge optional whitespace, meaning space and horizontal-tab bytes immediately after the
colon or at the end of the field line.
Every interior byte is retained, including obs-text and malformed UTF-8.
The string decoder represents each malformed input byte as a replacement character while preserving its original native
byte storage.
Consequently, the regular character API is safe to use, and reserialization writes the original bytes unchanged.
Encoders use canonical Name: value framing and never require a parallel byte-oriented field API.
Incremental HTTP/1.x Codecs
The HTTP/1.x request and response codecs are internal implementation components.
They are transport-independent and callback-free.
Input is accepted incrementally into a bounded queue, and decoding yields message-head, body, trailers, and completion
events.
End-of-input is signalled explicitly.
Completed codecs can reset while retaining pipelined input; protocol-switch and successful CONNECT responses expose
the remaining bytes as opaque data.
Parsing is strict: lines require CRLF, start-line spacing is exact, obsolete folding and whitespace before a field colon
are rejected, and framing ambiguities are errors.
Repeated or comma-separated Content-Length values are accepted only if every value is valid and identical.
Content-Length together with Transfer-Encoding is always rejected.
Chunked bodies are dechunked, chunk extensions are validated and discarded, and trailers remain separate from the
initial headers.
Only unclassified extension fields are permitted in trailers.
Response framing applies the special rules for HEAD, informational responses, 101, 204, 304, and
successful CONNECT.
Apart from final chunked, transfer codings and compression are not implemented by these codecs.
Limits
Default limits are 8 KiB for a start line, the configured HttpHeaderLimits separately for headers and trailers, 8
KiB for each chunk-metadata line, 16 MiB for a decoded body, 16 KiB for yielded body chunks, and 1 MiB for each retained
input or output queue.
Limits are checked before attacker-controlled allocation.
Interface
-
enum class erbsland::network::HttpCookieSameSite : uint8_t
SameSite policy for the built-in HTTP session cookie.
Values:
-
enumerator Strict
Send only in same-site contexts.
-
enumerator Lax
Permit safe top-level cross-site navigation.
-
enumerator None
Permit cross-site use; requires a secure cookie.
-
enumerator Strict
-
class HttpField
One validated HTTP field with an exact value.
Field values may contain obs-text and malformed UTF-8 bytes, but never prohibited HTTP control bytes.
See: HTTP Protocol Types
Public Functions
-
HttpField() noexcept = default
Create an invalid empty placeholder.
-
HttpField(HttpFieldName name, text::String value)
Create a field from a validated name and exact value.
- Throws:
err::ParameterError – If the name is invalid or the value contains a prohibited control byte.
-
HttpField(text::String name, text::String value)
Create a field from name text and an exact value.
- Throws:
err::ParameterError – If the name or value is invalid.
-
std::strong_ordering operator<=>(const HttpField &other) const noexcept = default
Compare the case-insensitive name and exact value.
-
inline bool isValid() const noexcept
Test whether this field has a valid name.
-
inline const HttpFieldName &name() const noexcept
Get the validated field name.
-
HttpField() noexcept = default
-
class HttpFieldName
A validated case-insensitive HTTP field name.
The original ASCII spelling is retained while equality, ordering, and hashing use ASCII case folding.
See: HTTP Protocol Types
Public Functions
-
HttpFieldName() noexcept = default
Create an invalid placeholder.
-
HttpFieldName(HttpFieldType type) noexcept
Create the conventional name for a recognized field type.
-
explicit HttpFieldName(text::String text)
Create a validated field name.
- Throws:
err::ParameterError – If the text is not a non-empty ASCII token.
-
std::strong_ordering operator<=>(const HttpFieldName &other) const noexcept
Compare field names with ASCII case folding.
-
bool operator==(const HttpFieldName &other) const noexcept
Test field-name equality with ASCII case folding.
-
inline bool isValid() const noexcept
Test whether this name is valid.
-
inline HttpFieldType type() const noexcept
Get the recognized field classification.
-
inline std::size_t toHash() const noexcept
Create an ASCII-case-insensitive hash.
Public Static Functions
-
static HttpFieldName fromString(const text::String &text) noexcept
Parse a field name, returning an invalid placeholder on failure.
-
static HttpFieldName fromStringOrThrow(const text::String &text)
Parse a field name.
- Throws:
err::ParseError – If the text is not a non-empty ASCII token.
-
HttpFieldName() noexcept = default
-
class HttpFieldType
A recognized HTTP field-name classification.
Applicability metadata is descriptive and never makes an extension field invalid.
See: HTTP Protocol Types
Public Types
-
enum Value
Recognized field names from the HTTP core and cookie specifications.
Values:
-
enumerator Unknown
An unrecognized extension field.
-
enumerator Accept
The Accept request field.
-
enumerator AcceptCharset
The Accept-Charset request field.
-
enumerator AcceptEncoding
The Accept-Encoding field.
-
enumerator AcceptLanguage
The Accept-Language request field.
-
enumerator AcceptRanges
The Accept-Ranges response field.
-
enumerator Age
The Age response field.
-
enumerator Allow
The Allow response field.
-
enumerator AuthenticationInfo
The Authentication-Info response field.
-
enumerator Authorization
The Authorization request field.
-
enumerator CacheControl
The Cache-Control field.
-
enumerator Connection
The Connection field.
-
enumerator ContentEncoding
The Content-Encoding representation field.
-
enumerator ContentLanguage
The Content-Language representation field.
-
enumerator ContentLength
The Content-Length field.
-
enumerator ContentLocation
The Content-Location representation field.
-
enumerator ContentRange
The Content-Range representation field.
-
enumerator ContentType
The Content-Type representation field.
-
enumerator Cookie
The Cookie request field.
-
enumerator Date
The Date field.
-
enumerator ETag
The ETag response field.
-
enumerator Expect
The Expect request field.
-
enumerator Expires
The Expires response field.
-
enumerator From
The From request field.
-
enumerator IfMatch
The If-Match request field.
-
enumerator IfModifiedSince
The If-Modified-Since request field.
-
enumerator IfNoneMatch
The If-None-Match request field.
-
enumerator IfRange
The If-Range request field.
-
enumerator IfUnmodifiedSince
The If-Unmodified-Since request field.
-
enumerator LastModified
The Last-Modified response field.
-
enumerator Location
The Location response field.
-
enumerator MaxForwards
The Max-Forwards request field.
-
enumerator Pragma
The Pragma field.
-
enumerator ProxyAuthenticate
The Proxy-Authenticate response field.
-
enumerator ProxyAuthenticationInfo
The Proxy-Authentication-Info response field.
-
enumerator ProxyAuthorization
The Proxy-Authorization request field.
-
enumerator Range
The Range request field.
-
enumerator Referer
The Referer request field.
-
enumerator RetryAfter
The Retry-After response field.
-
enumerator Server
The Server response field.
-
enumerator SetCookie
The Set-Cookie response field.
-
enumerator Te
The TE request field.
-
enumerator Trailer
The Trailer field.
-
enumerator TransferEncoding
The Transfer-Encoding field.
-
enumerator Upgrade
The Upgrade field.
-
enumerator UserAgent
The User-Agent request field.
-
enumerator Vary
The Vary response field.
-
enumerator Via
The Via field.
-
enumerator Warning
The Warning field.
-
enumerator WwwAuthenticate
The WWW-Authenticate response field.
-
enumerator Unknown
Public Functions
-
inline constexpr bool isKnown() const noexcept
Test whether this type is recognized.
-
bool isRequestField() const noexcept
Test whether this field is defined for requests.
-
bool isResponseField() const noexcept
Test whether this field is defined for responses.
Public Static Functions
-
static HttpFieldType fromString(const text::String &name) noexcept
Classify a valid field name using ASCII-case-insensitive matching.
-
enum Value
-
class HttpHeaderLimits
Resource limits captured by an ordered HTTP header collection.
See: HTTP Protocol Types
Public Functions
-
inline constexpr unit::ItemCount maximumFieldCount() const noexcept
Get the maximum number of fields.
-
inline constexpr HttpHeaderLimits &setMaximumFieldCount(unit::ItemCount value) noexcept
Set the maximum number of fields.
-
inline constexpr unit::ByteLength maximumNameLength() const noexcept
Get the maximum field-name byte length.
-
inline constexpr HttpHeaderLimits &setMaximumNameLength(unit::ByteLength value) noexcept
Set the maximum field-name byte length.
-
inline constexpr unit::ByteLength maximumValueLength() const noexcept
Get the maximum field-value byte length.
-
inline constexpr HttpHeaderLimits &setMaximumValueLength(unit::ByteLength value) noexcept
Set the maximum field-value byte length.
-
inline constexpr unit::ByteLength maximumAggregateLength() const noexcept
Get the maximum aggregate serialized byte length.
-
inline constexpr HttpHeaderLimits &setMaximumAggregateLength(unit::ByteLength value) noexcept
Set the maximum aggregate serialized byte length.
Public Static Attributes
-
static constexpr auto cDefaultMaximumFieldCount = unit::ItemCount{100U}
Default maximum number of fields.
-
static constexpr auto cDefaultMaximumNameLength = unit::ByteLength{256U}
Default maximum field-name byte length.
-
static constexpr auto cDefaultMaximumValueLength = unit::ByteLength{16U * 1024U}
Default maximum field-value byte length.
-
static constexpr auto cDefaultMaximumAggregateLength = unit::ByteLength{64U * 1024U}
Default maximum aggregate serialized byte length.
-
inline constexpr unit::ItemCount maximumFieldCount() const noexcept
-
using erbsland::network::HttpFieldList = util::List<HttpField>
An ordered copy-on-write list of HTTP fields.
-
class HttpHeaders
An ordered, bounded, copy-on-write HTTP header collection.
Repeated fields and exact field values are preserved. Captured limits are operational and are not part of equality.
See: HTTP Protocol Types
Public Functions
-
HttpHeaders() = default
Create an empty collection with default limits.
-
inline explicit HttpHeaders(HttpHeaderLimits limits) noexcept
Create an empty collection with captured limits.
-
explicit HttpHeaders(HttpFieldList fields, HttpHeaderLimits limits = {})
Create a validated collection from fields and captured limits.
- Throws:
err::ParameterError – If a field or aggregate limit is exceeded.
-
inline bool operator==(const HttpHeaders &other) const noexcept
Compare ordered fields while ignoring captured limits.
-
inline constexpr HttpHeaderLimits limits() const noexcept
Get the captured resource limits.
-
unit::ByteLength serializedLength() const noexcept
Get the serialized byte length using
name: valueplus CRLF for each field.
-
inline HttpFieldList fields() const noexcept
Get a copy-on-write copy of all ordered fields.
-
inline HttpField field(unit::ItemIndex index) const
Get a field by index, or an invalid field if the index is outside the list.
-
bool hasField(const HttpFieldName &name) const noexcept
Test whether at least one field has the given name.
-
bool hasField(HttpFieldType type) const noexcept
Test whether at least one recognized field has the given type.
-
bool hasField(const text::String &name) const noexcept
Test whether at least one field has the given valid text name.
-
text::String getFirst(const HttpFieldName &name) const noexcept
Get the first exact value for a field, or empty text if absent.
-
text::String getFirst(HttpFieldType type) const noexcept
Get the first exact value for a recognized field, or empty text if absent.
-
text::String getFirst(const text::String &name) const noexcept
Get the first exact value for a valid text field name, or empty text if absent.
-
text::StringList getAll(const HttpFieldName &name) const
Get every exact value for a field in original order.
-
text::StringList getAll(HttpFieldType type) const
Get every exact value for a recognized field in original order.
-
text::StringList getAll(const text::String &name) const
Get every exact value for a valid text field name in original order.
-
HttpHeaders &addField(HttpField field)
Append a field.
- Throws:
err::ParameterError – If the resulting collection exceeds captured limits.
-
HttpHeaders &addField(HttpFieldType type, text::String value)
Append a recognized field.
- Throws:
err::ParameterError – If the field or resulting collection is invalid.
-
HttpHeaders &addField(text::String name, text::String value)
Append a field from text.
- Throws:
err::ParameterError – If the field or resulting collection is invalid.
-
HttpHeaders &setField(HttpField field)
Replace all matching fields with one field at the first matching position, or append it.
- Throws:
err::ParameterError – If the resulting collection exceeds captured limits.
-
HttpHeaders &setField(HttpFieldType type, text::String value)
Replace a recognized field.
- Throws:
err::ParameterError – If the field or resulting collection is invalid.
-
HttpHeaders &setField(text::String name, text::String value)
Replace a field from text.
- Throws:
err::ParameterError – If the field or resulting collection is invalid.
-
unit::ItemCount removeAllFields(const HttpFieldName &name)
Remove all fields with a matching name and return the number removed.
-
unit::ItemCount removeAllFields(HttpFieldType type)
Remove all fields with a recognized type and return the number removed.
-
unit::ItemCount removeAllFields(const text::String &name)
Remove all fields with a valid text name and return the number removed.
-
std::optional<HttpMediaType> contentType() const noexcept
Parse the first Content-Type field, or return no value if absent or invalid.
-
HttpHeaders &setContentType(const HttpMediaType &mediaType)
Set one canonical Content-Type field.
- Throws:
err::ParameterError – If the media type is invalid or limits are exceeded.
-
HttpHeaders() = default
-
using erbsland::network::HttpMediaTypeParameters = util::List<HttpMediaTypeParameter>
An ordered copy-on-write list of media-type parameters.
-
class HttpMediaType
A validated HTTP media type with ordered unique parameters.
Type, subtype, and parameter names are canonical lowercase ASCII. Parameter values retain their semantic text.
See: HTTP Protocol Types
Public Functions
-
HttpMediaType() noexcept = default
Create an invalid placeholder.
-
HttpMediaType(text::String type, text::String subtype)
Create a media type without parameters.
- Throws:
err::ParameterError – If either token is invalid.
-
HttpMediaType(text::String type, text::String subtype, HttpMediaTypeParameters parameters)
Create a media type with ordered unique parameters.
- Throws:
err::ParameterError – If either token is invalid or a parameter name is duplicated.
-
std::strong_ordering operator<=>(const HttpMediaType &other) const noexcept = default
Compare canonical type, subtype, and ordered parameters.
-
inline bool isValid() const noexcept
Test whether this media type is valid.
-
inline HttpMediaTypeParameters parameters() const noexcept
Get a copy-on-write copy of the ordered parameters.
-
bool hasParameter(const text::String &name) const noexcept
Test whether a parameter is present using ASCII-case-insensitive name matching.
-
std::optional<text::String> parameter(const text::String &name) const noexcept
Get the first matching semantic parameter value.
-
HttpMediaType &setParameter(HttpMediaTypeParameter parameter)
Set a parameter in place, preserving the first matching position or appending it.
- Throws:
err::ParameterError – If the parameter is invalid.
-
HttpMediaType &setParameter(text::String name, text::String value)
Set a parameter in place from text.
- Throws:
err::ParameterError – If the name or value is invalid.
-
HttpMediaType &removeParameter(const text::String &name)
Remove a parameter using ASCII-case-insensitive name matching.
Public Static Functions
-
static HttpMediaType fromString(const text::String &text) noexcept
Parse a media type, returning an invalid placeholder on failure.
-
static HttpMediaType fromStringOrThrow(const text::String &text)
Parse a media type.
- Throws:
err::ParseError – If the syntax, limits, or parameter uniqueness rules are violated.
Public Static Attributes
-
static constexpr auto cMaximumTextLength = unit::ByteLength{16U * 1024U}
Maximum standalone media-type text length.
-
HttpMediaType() noexcept = default
-
class HttpMediaTypeParameter
One validated HTTP media-type parameter.
Parameter names are canonical lowercase ASCII tokens. Values are semantic unquoted UTF-8 text.
See: HTTP Protocol Types
Public Functions
-
HttpMediaTypeParameter(text::String name, text::String value)
Create a validated media-type parameter.
- Throws:
err::ParameterError – If the name or value is invalid.
-
std::strong_ordering operator<=>(const HttpMediaTypeParameter &other) const noexcept = default
Compare canonical names and exact semantic values.
-
HttpMediaTypeParameter(text::String name, text::String value)
-
class HttpMethod
A validated standard or extension HTTP method.
Method names are case-sensitive. Standard classification recognizes only canonical uppercase spellings.
See: HTTP Protocol Types
Public Functions
-
HttpMethod() noexcept = default
Create an invalid placeholder.
-
HttpMethod(HttpMethodType type) noexcept
Create a recognized standard method, or an invalid placeholder for
NoneandAll.
-
std::strong_ordering operator<=>(const HttpMethod &other) const noexcept = default
Compare method names exactly.
-
inline bool isValid() const noexcept
Test whether this method contains a valid token.
-
inline bool isStandard() const noexcept
Test whether this method is a recognized standard method.
-
inline bool isExtension() const noexcept
Test whether this is a valid extension method.
-
std::optional<HttpMethodType> standardType() const noexcept
Get the recognized standard type, or no value for invalid and extension methods.
Public Static Functions
-
static HttpMethod fromString(const text::String &text) noexcept
Parse a method token, returning an invalid placeholder on failure.
-
static HttpMethod fromStringOrThrow(const text::String &text)
Parse a method token.
- Throws:
err::ParseError – If the text is empty or is not an HTTP token.
-
HttpMethod() noexcept = default
-
enum class erbsland::network::HttpMethodType : uint16_t
A recognized standard HTTP method flag.
Values:
-
enumerator None
No recognized method.
-
enumerator Connect
CONNECT.
-
enumerator Delete
DELETE.
-
enumerator Get
GET.
-
enumerator Head
HEAD.
-
enumerator Options
OPTIONS.
-
enumerator Patch
PATCH.
-
enumerator Post
POST.
-
enumerator Put
PUT.
-
enumerator Trace
TRACE.
-
enumerator All
Every recognized standard method.
-
enumerator None
-
using erbsland::network::HttpMethodTypes = util::EnumFlags<HttpMethodType>
A set of recognized standard HTTP methods.
-
class HttpRequestHead
The control data and header section of an HTTP request.
The request-target retains its exact validated ASCII wire spelling.
See: HTTP Protocol Types
Public Functions
-
HttpRequestHead() noexcept = default
Create an invalid placeholder.
-
HttpRequestHead(HttpMethod method, text::String target, HttpVersion version, HttpHeaders headers = {})
Create a validated request head.
- Parameters:
method – The valid request method.
target – The exact nonempty ASCII request-target.
version – The supported HTTP version.
headers – The ordered request header fields.
- Throws:
err::ParameterError – If a control value is invalid.
-
bool operator==(const HttpRequestHead &other) const noexcept = default
Compare all request-head values.
-
bool isValid() const noexcept
Test whether the control data is valid.
-
inline const HttpMethod &method() const noexcept
Get the exact method.
-
inline HttpVersion version() const noexcept
Get the HTTP version.
-
inline const HttpHeaders &headers() const noexcept
Get the ordered header fields.
-
HttpRequestHead() noexcept = default
-
class HttpResponseHead
The control data and header section of an HTTP response.
The reason phrase retains its exact bytes, including obs-text and malformed UTF-8.
See: HTTP Protocol Types
Public Functions
-
HttpResponseHead() noexcept = default
Create an invalid placeholder.
-
HttpResponseHead(HttpVersion version, HttpStatus status, text::String reasonPhrase, HttpHeaders headers = {})
Create a validated response head.
- Parameters:
version – The supported HTTP version.
status – The valid response status.
reasonPhrase – The exact optional reason phrase.
headers – The ordered response header fields.
- Throws:
err::ParameterError – If a control value is invalid.
-
bool operator==(const HttpResponseHead &other) const noexcept = default
Compare all response-head values.
-
bool isValid() const noexcept
Test whether the control data is valid.
-
inline HttpVersion version() const noexcept
Get the HTTP version.
-
inline HttpStatus status() const noexcept
Get the response status.
-
inline const HttpHeaders &headers() const noexcept
Get the ordered header fields.
-
HttpResponseHead() noexcept = default
-
class HttpStatus
A valid HTTP status code or an invalid placeholder.
The value accepts extension codes from 100 through 599. Named values follow RFC 9110 plus selected registered codes.
See: HTTP Protocol Types
Public Types
-
enum Value
Known HTTP status codes.
Values:
-
enumerator Invalid
No valid status.
-
enumerator Continue
Continue.
-
enumerator SwitchingProtocols
Switching Protocols.
-
enumerator EarlyHints
Early Hints.
-
enumerator Ok
OK.
-
enumerator Created
Created.
-
enumerator Accepted
Accepted.
-
enumerator NonAuthoritativeInformation
Non-Authoritative Information.
-
enumerator NoContent
No Content.
-
enumerator ResetContent
Reset Content.
-
enumerator PartialContent
Partial Content.
-
enumerator MultipleChoices
Multiple Choices.
-
enumerator MovedPermanently
Moved Permanently.
-
enumerator Found
Found.
-
enumerator SeeOther
See Other.
-
enumerator NotModified
Not Modified.
-
enumerator UseProxy
Use Proxy (deprecated).
-
enumerator TemporaryRedirect
Temporary Redirect.
-
enumerator PermanentRedirect
Permanent Redirect.
-
enumerator BadRequest
Bad Request.
-
enumerator Unauthorized
Unauthorized.
-
enumerator PaymentRequired
Payment Required.
-
enumerator Forbidden
Forbidden.
-
enumerator NotFound
Not Found.
-
enumerator MethodNotAllowed
Method Not Allowed.
-
enumerator NotAcceptable
Not Acceptable.
-
enumerator ProxyAuthenticationRequired
Proxy Authentication Required.
-
enumerator RequestTimeout
Request Timeout.
-
enumerator Conflict
Conflict.
-
enumerator Gone
Gone.
-
enumerator LengthRequired
Length Required.
-
enumerator PreconditionFailed
Precondition Failed.
-
enumerator ContentTooLarge
Content Too Large.
-
enumerator UriTooLong
URI Too Long.
-
enumerator UnsupportedMediaType
Unsupported Media Type.
-
enumerator RangeNotSatisfiable
Range Not Satisfiable.
-
enumerator ExpectationFailed
Expectation Failed.
-
enumerator MisdirectedRequest
Misdirected Request.
-
enumerator UnprocessableContent
Unprocessable Content.
-
enumerator UpgradeRequired
Upgrade Required.
-
enumerator TooManyRequests
Too Many Requests.
-
enumerator RequestHeaderFieldsTooLarge
Request Header Fields Too Large.
Unavailable For Legal Reasons.
-
enumerator InternalServerError
Internal Server Error.
-
enumerator NotImplemented
Not Implemented.
-
enumerator BadGateway
Bad Gateway.
Service Unavailable.
-
enumerator GatewayTimeout
Gateway Timeout.
-
enumerator HttpVersionNotSupported
HTTP Version Not Supported.
-
enumerator Invalid
Public Functions
-
inline constexpr bool isValid() const noexcept
Test whether the code is in the valid 100—599 range.
-
inline constexpr bool isInformational() const noexcept
Test whether this is an informational status.
-
inline constexpr bool isSuccessful() const noexcept
Test whether this is a successful status.
-
inline constexpr bool isRedirection() const noexcept
Test whether this is a redirection status.
-
inline constexpr bool isClientError() const noexcept
Test whether this is a client-error status.
-
inline constexpr bool isServerError() const noexcept
Test whether this is a server-error status.
-
inline constexpr uint16_t code() const noexcept
Get the numeric status code, or zero for an invalid status.
Public Static Functions
-
static inline constexpr HttpStatus fromCode(const uint16_t code) noexcept
Create a status from a numeric code, returning an invalid placeholder outside 100—599.
-
static HttpStatus fromCodeOrThrow(uint16_t code)
Create a status from a numeric code.
- Throws:
err::ParameterError – If the code is outside 100—599.
-
static HttpStatus fromString(const text::String &text) noexcept
Parse exactly three decimal digits, returning an invalid placeholder on failure.
-
static HttpStatus fromStringOrThrow(const text::String &text)
Parse exactly three decimal digits.
- Throws:
err::ParseError – If the text is malformed or outside 100—599.
-
enum Value
-
class HttpVersion
A supported HTTP protocol version.
See: HTTP Protocol Types
Public Types
Public Functions
-
inline constexpr bool isValid() const noexcept
Test whether this version is supported.
-
inline constexpr uint8_t major() const noexcept
Get the major version number, or zero for an invalid version.
-
inline constexpr uint8_t minor() const noexcept
Get the minor version number, or zero for an invalid version.
Public Static Functions
-
static HttpVersion fromString(const text::String &text) noexcept
Parse an exact HTTP-version token, returning an invalid placeholder on failure.
-
static HttpVersion fromStringOrThrow(const text::String &text)
Parse an exact HTTP-version token.
- Throws:
err::ParseError – If the version is malformed or unsupported.
-
inline constexpr bool isValid() const noexcept