package tiny_httpd
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=eac8a3ca6e8cd463817e0c62c2cc8181b8ef705a97a7ac6afbbdceae30b42b54
sha512=e0ae94038b7d8f470133005437a1d2a620274fe13f15ce5521817751ae2603c1ed6f635a32a4b3a4ce4d9718f6d53cad6dfafa467a7b7554c86735a82fa1db25
doc/tiny_httpd/Tiny_httpd_server/Request/index.html
Module Tiny_httpd_server.Request
Source
type '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
or1, 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
.
Pretty print the request and its body. The exact format of this printing is not specified.
Pretty print the request without its body. The exact format of this printing is not specified.
get_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
.
Same 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.
Client address of the request.
time stamp (from Unix.gettimeofday
) after parsing the first line of the request
Limit the body size to max_size
bytes, or return a 413
error.
Read the whole body into a string. Potentially blocking.