Header Typeclass and Common Headers #
This module defines the Header typeclass for typed HTTP headers and some common header parsers.
Reference: https://www.rfc-editor.org/rfc/rfc9110.html#name-representation-data-and-met
Typeclass for typed HTTP headers that can be parsed from and serialized to header values.
Parses a header value into the typed representation.
Parses a header value into the typed representation.
Serializes the typed representation back to a name-value pair.
Serializes the typed representation back to a name-value pair.
Instances
Equations
- One or more equations did not get rendered due to their size.
The Content-Length header, representing the size of the message body in bytes.
Parses only valid natural number values.
Reference: https://www.rfc-editor.org/rfc/rfc9110.html#section-8.6-2
Instances For
Equations
- Std.Http.Header.instBEqContentLength.beq { length := a } { length := b } = (a == b)
- Std.Http.Header.instBEqContentLength.beq x✝¹ x✝ = false
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Parses a content length header value.
Equations
Instances For
Serializes a content length header back to a name-value pair.
Equations
Instances For
Equations
- Std.Http.Header.ContentLength.inst = { parse := Std.Http.Header.ContentLength.parse, serialize := Std.Http.Header.ContentLength.serialize }
Validates the chunked placement rules for the Transfer Encoding header. Returns false if the
encoding list violates the constraints.
Reference: https://www.rfc-editor.org/rfc/rfc9112#section-6.1
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Transfer-Encoding header, representing the list of transfer codings applied to the message body.
Validation rules (RFC 9112 Section 6.1):
- "chunked" may appear at most once.
- If "chunked" is present, it must be the last encoding in the list.
Reference: https://www.rfc-editor.org/rfc/rfc9112#section-6.1
The ordered list of transfer codings.
The ordered list of transfer codings.
Proof that the transfer codings satisfy the chunked placement rules.
Proof that the transfer codings satisfy the chunked placement rules.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Returns true if the transfer encoding ends with chunked.
Instances For
Parses a comma-separated list of transfer codings from a header value, validating chunked placement.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Serializes a transfer encoding back to a comma-separated header value.
Equations
Instances For
Equations
The Connection header, represented as a list of connection option tokens.
Reference: https://www.rfc-editor.org/rfc/rfc9110.html#name-connection
The normalized connection-option tokens.
The normalized connection-option tokens.
Proof that all tokens satisfy
isToken.Proof that all tokens satisfy
isToken.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Checks whether the Connection header requests connection close semantics.
Equations
- connection.shouldClose = connection.containsToken "close"
Instances For
Parses a Connection header value into normalized tokens.
Equations
- Std.Http.Header.Connection.parse v = do let tokens ← Std.Http.Header.parseTokenList✝ v if h : tokens.all Std.Http.Internal.isToken = true then some { tokens := tokens, valid := h } else none
Instances For
Serializes a Connection header back to a comma-separated value.
Equations
- connection.serialize = (Std.Http.Header.Name.connection, Std.Http.Header.Value.ofString! (",".intercalate connection.tokens.toList))
Instances For
Equations
- Std.Http.Header.Connection.inst = { parse := Std.Http.Header.Connection.parse, serialize := Std.Http.Header.Connection.serialize }
The Host header.
Represents the authority component of a URI: host [ ":" port ]
Reference: https://www.rfc-editor.org/rfc/rfc9110.html#name-host-and-authority
Instances For
Equations
- Std.Http.Header.instReprHost = { reprPrec := Std.Http.Header.instReprHost.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Std.Http.Header.Host.inst = { parse := Std.Http.Header.Host.parse, serialize := Std.Http.Header.Host.serialize }
The Expect header.
Represents an expectation token.
The only standardized expectation is 100-continue.
Reference: https://www.rfc-editor.org/rfc/rfc9110.html#name-expect
Instances For
Equations
- Std.Http.Header.instReprExpect.repr x✝ prec✝ = Std.Format.bracket "{ " Std.Format.nil " }"
Instances For
Equations
Equations
- Std.Http.Header.instBEqExpect.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
Parses an Expect header.
Succeeds only if the value is exactly 100-continue
(case-insensitive, trimmed).
Equations
Instances For
Serializes an Expect header.
Equations
- x✝.serialize = (Std.Http.Header.Name.expect, Std.Http.Header.Value.ofString! "100-continue")
Instances For
Equations
- Std.Http.Header.Expect.inst = { parse := Std.Http.Header.Expect.parse, serialize := Std.Http.Header.Expect.serialize }