package cohttp-lwt-unix

  1. Overview
  2. Docs

Basic satisfaction of Cohttp_lwt.Net

module IO : sig ... end
type ctx = {
  1. ctx : Conduit_lwt_unix.ctx;
  2. resolver : Resolver_lwt.t;
}
val sexp_of_ctx : ctx -> Ppx_sexp_conv_lib.Sexp.t
val default_ctx : ctx

default_ctx is the default network context. It uses Conduit_lwt_unix.default_ctx and Resolver_lwt_unix.system.

val init : ?ctx:Conduit_lwt_unix.ctx -> ?resolver:Resolver_lwt.t -> unit -> ctx

init ?ctx ?resolver () is a network context that is the same as the default_ctx, but with either the connection handling or resolution module overridden with ctx or resolver respectively. This is useful to supply a Conduit_lwt_unix.resolver with a custom source network interface, or a Resolver_lwt.t with a different name resolution strategy (for instance to override a hostname to point it to a Unix domain socket).

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 extend ctx 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 extend ctx 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.

val close_in : 'a Lwt_io.channel -> unit
val close_out : 'a Lwt_io.channel -> unit
val close : 'a Lwt_io.channel -> 'b Lwt_io.channel -> unit
OCaml

Innovation. Community. Security.