Webs.Http
HTTP requests and responses.
HTTP requests, responses, associated types, values, codecs and protocol logic fragments.
References.
module Base64 : sig ... end
base64
and base64url
codecs.
module Pct : sig ... end
Percent-encoding codec.
module Digits : sig ... end
HTTP digits codec.
HTTP often requires to perform US-ASCII case insensitive comparisons on HTTP tokens. Values of type name
represent US-ASCII lowercased HTTP tokens.
The type for lowercased HTTP tokens. In particular header field-names.
module Name : sig ... end
Names.
The type for HTTP versions. Both integers must be in the interval [0;9]
.
module Version : sig ... end
HTTP versions.
type meth = [
| `GET | (**) |
| `HEAD | (**) |
| `POST | (**) |
| `PUT | (**) |
| `DELETE | (**) |
| `CONNECT | (**) |
| `OPTIONS | (**) |
| `TRACE | (**) |
| `PATCH | (*
|
| `Other of string | (* other token *) |
]
The type for HTTP request methods.
module Meth : sig ... end
HTTP request methods
The type for absolute URI paths represented as non-empty lists of percent-decoded path segments. The empty list denotes the absence of a path.
Path segments can be empty ""
. The root path /
is represented by the list [""]
and /a
by ["a"]
, see more examples here.
WARNING. You should never concatenate these segments with a separator to get a file path because they may contain stray percent-decoded directory separators. Use the function Path.to_absolute_filepath
to interpret paths as file paths.
module Path : sig ... end
Paths.
The type for queries as key-values maps. Both keys and values are properly decoded. Note that keys can map to multiple values.
module Query : sig ... end
Queries and query codecs.
The type for HTTP headers. Maps header names to string values such that for:
','
separated as per specification. Use Headers.values_of_string
on the string.set_cookie
header, must be treated specially since it can be repeated but does not follow the syntax of multi-valued headers. The values are stored in the string separated by '\x00'
values. Use Headers.add_set_cookie
and Headers.values_of_set_cookie_value
to handle the field. On Headers
.encode this results in separate set-cookie
headers.module Headers : sig ... end
HTTP headers and values.
module Cookie : sig ... end
Cookies.
module Etag : sig ... end
Entity tags.
module Range : sig ... end
Range requests.
val accept_charset : name
val accept_encoding : name
val accept_language : name
val accept_ranges : name
val authorization : name
val cache_control : name
val connection : name
val content_encoding : name
val content_language : name
val content_length : name
val content_location : name
val content_range : name
val content_type : name
val if_modified_since : name
val if_none_match : name
val if_unmodified_since : name
val last_modified : name
val max_forwards : name
val proxy_authenticate : name
val proxy_authorization : name
val retry_after : name
val set_cookie : name
val transfer_encoding : name
val user_agent : name
val www_authenticate : name
The type for HTTP status codes.
module Status : sig ... end
Statuses.
module Mime_type : sig ... end
MIME type constants and file extensions.
module Resp : sig ... end
HTTP responses.
module Req : sig ... end
HTTP requests.
The type for services. Maps requests to responses. Note that services should not raise exceptions (but connectors should be prepared to handle spurious ones).
Low-level codecs
Warning. This API is unstable and subject to change between minor versions of the library.
module Private : sig ... end