ACME implementation in OCaml
Parameter #1 Letsencrypt . Client . Make . Http
type ctx

Type of the user-defined context.

The context is an user-defined value which can be passed to your HTTP client implementation to be able to tweak some internal details about the underlying request/connection used to get an HTTP response.

For instance, an HTTP implementation can optionally require some value such as the internal buffer size or a time-out value, etc. The interface wants to allow the implementer to pass such information via the ctx type.

In others words, anything optionnaly needed to initiate/do the HTTP request and that is not described over this interface (by arguments, types, etc.) can be passed via the user-defined ctx type.

For instance, MirageOS uses this ctx as a ressource allocator to initiate a TCP/IP connection or a TLS connection - and, by this way, it fully abstracts the HTTP client implementation over the TCP/IP and the TLS stack (for more details, see mimic).

Of course, ctx = unit if you don't need to pass extra-information when you want to do an HTTP request/connection.

module Headers : sig ... end
module Body : sig ... end
module Response : sig ... end
val head : ?ctx:ctx -> ?headers:Headers.t -> Uri.t -> Response.t Lwt.t

head ?ctx ?headers uri sends an HEAD HTTP request to the given uri and returns its response. The returned response does not have a body according to the HTTP standard.

val get : ?ctx:ctx -> ?headers:Headers.t -> Uri.t -> (Response.t * Body.t) Lwt.t

get ?ctx ?headers uri sends an GET HTTP request to the given uri and returns its response with its body.

val post : ?ctx:ctx -> ?body:Body.t -> ?chunked:bool -> ?headers:Headers.t -> Uri.t -> (Response.t * Body.t) Lwt.t

post ?ctx ?body ?chunked ?headers uri sends an POST HTTP request with the optional given body using chunked encoding if chunked is true (default to false). It returns a response and a body.