package cohttp-mirage
Library
Module
Module type
Parameter
Class
Class type
module IO : Cohttp_lwt.S.IO
Conduit context. Contains configuration of resolver, local source address, TLS / SSL library, certificates, keys.
Depending on ctx
, the library is able to send HTTP requests unencrypted or encrypted one with a secured protocol (such as TLS). Depending on how conduit is configured, ctx
might initiate a secured connection with TLS (using ocaml-tls
) or SSL (using ocaml-ssl
), on *:443
or on the specified port by the user. If neitehr ocaml-tls
or ocaml-ssl
are installed on the system, cohttp
/conduit
tries the usual (*:80
) or the specified port by the user in a non-secured way.
val sexp_of_ctx : ctx -> Sexplib0.Sexp.t
resolve ~ctx uri
resolves uri
into an endpoint description. This is Resolver_lwt.resolve_uri ~uri ctx.resolver
.
connect_uri ~ctx uri
starts a flow on the given uri
. The choice of the protocol (with or without encryption) is done by the scheme of the given uri
:
- If the scheme is
https
, we will extendctx
to be able to start a TLS connection with a default TLS configuration (no authentication) on the default or user-specified port. - If the scheme is
http
, we will extendctx
to be able to start a simple TCP/IP connection on the default or user-specified port.
These extensions have the highest priority (Conduit
will try to initiate a communication with them first). By extension, we mean that the user is able to fill its own ctx
and we don't overlap resolution functions from the given ctx
.
This is resolve ~ctx uri >>= connect_endp ~ctx
.
connect_endp ~ctx endp
starts a flow to the given endp
. endp
describes address and protocol of the endpoint to connect to.
val close_in : IO.ic -> unit
val close_out : IO.oc -> unit