http
An HTTP request/response parser and serializer for Carp.
Parse requests with Request.parse, responses with
Response.parse. Build requests with
Request.get, Request.post, etc.
Status codes are available as constants in the Status module.
Form bodies can be parsed with Form.parse, and
multipart/form-data ones with
Request.multipart-data.
Content is negotiated with Accept,
AcceptEncoding and
AcceptLanguage, or the Request wrappers around them.
Auth reads and writes the RFC 7235 authentication headers,
ByteRange the RFC 9110 range headers.
Parsing
(match (Request.parse "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
(Result.Success req) (println* (Request.verb &req))
(Result.Error e) (IO.errorln &e))
Status codes
Status.ok ; => 200
Status.not-found ; => 404
(Status.reason 200) ; => "OK"