Tiny_httpd_server.Requesttype 'body t = private {meth : Meth.t;HTTP method for this request.
*)host : string;client_addr : Unix.sockaddr;Client address. Available since 0.14.
*)headers : Headers.t;List of headers.
*)http_version : int * int;HTTP version. This should be either 1, 0 or 1, 1.
path : string;Full path of the requested URL.
*)path_components : string list;Components of the path of the requested URL.
*)query : (string * string) list;Query part of the requested URL.
*)body : 'body;Body of the request.
*)start_time : float;}A request with method, path, host, headers, and a body, sent by a client.
The body is polymorphic because the request goes through several transformations. First it has no body, as only the request and headers are read; then it has a stream body; then the body might be entirely read as a string via read_body_full.
val pp : Stdlib.Format.formatter -> string t -> unitPretty print the request and its body. The exact format of this printing is not specified.
val pp_ : Stdlib.Format.formatter -> _ t -> unitPretty print the request without its body. The exact format of this printing is not specified.
val get_header : ?f:(string -> string) -> _ t -> string -> string optionget_header req h looks up header h in req. It returns None if the header is not present. This is case insensitive and should be used rather than looking up h verbatim in headers.
val get_header_int : _ t -> string -> int optionSame as get_header but also performs a string to integer conversion.
set_header k v req sets k: v in the request req's headers.
Modify headers using the given function.
val host : _ t -> stringHost field of the request. It also appears in the headers.
val client_addr : _ t -> Unix.sockaddrClient address of the request.
val path : _ t -> stringRequest path.
val body : 'b t -> 'bRequest body, possibly empty.
val start_time : _ t -> floattime stamp (from Unix.gettimeofday) after parsing the first line of the request
val limit_body_size : max_size:int -> byte_stream t -> byte_stream tLimit the body size to max_size bytes, or return a 413 error.
val read_body_full :
?buf:Tiny_httpd_buf.t ->
?buf_size:int ->
byte_stream t ->
string tRead the whole body into a string. Potentially blocking.