Head.RequestA request's head, as a server reads it.
type t = {meth : Meth.t;target : string;the request-target as it arrived
*)form : form;version : version;HTTP/1.1 for any later HTTP/1 minor version, which is answered as the highest this server speaks
headers : (string * string) list;in the order sent, names as sent, values trimmed
*)host : string option;the host the request is for, as it was sent: an absolute-form or authority-form target's authority, otherwise the Host field -- None when neither names one
}The next head. Empty lines before it are skipped, as RFC 9112 asks. A request line is a method token, a target of visible ASCII and a version, each one space apart: another major version than HTTP/1 is 505, and a request line past max bytes 414. The target's form must be one its method may use, and an absolute one's authority a host with no userinfo. A field is what Field.parse reads; a bare CR and a field section past max bytes -- 431 -- are refused, and a line may end in a bare LF, which RFC 9112 lets a recipient accept.
An HTTP/1.1 request needs exactly one Host, and no request may carry two or one that is not a host (400, RFC 9112 §3.2) -- an absolute-form target included, whose authority is then the host all the same. A path or an asterisk names no host of its own, so beside one an empty Host is 400 too (RFC 9110 §4.2.1). A host is RFC 3986's: a name, or in brackets an IPv6 address or an IPvFuture, and never any other run of characters there; CONNECT's target is a host and a port, both there.
val keep_alive : t -> boolWhether the client asked to keep the connection: HTTP/1.1 unless Connection: close, and HTTP/1.0 only with Connection: keep-alive -- and never after an HTTP/1.0 request carrying Transfer-Encoding, which HTTP/1.0 does not have, so whoever framed it cannot be trusted to have ended it where it ends (RFC 9112 §6.1).