Up

module Cohttp_lwt_unix

: sig

HTTP client and server using the Lwt_unix interfaces.

Request and Response modules

#
module Request : Cohttp_lwt.Request with module IO = Cohttp_lwt_unix_io

The Request module holds the information about a HTTP request, and also includes the [root:Cohttp_lwt_unix_io] functions to handle large message bodies.

#
module Response : Cohttp_lwt.Response with module IO = Cohttp_lwt_unix_io

The Response module holds the information about a HTTP response, and also includes the [root:Cohttp_lwt_unix_io] functions to handle large message bodies.

Module types for Client and Server

#
module type C = sig

The Client module type defines the additional UNIX-specific functions that are exposed in addition to the Cohttp_lwt.Client interface.

include Cohttp_lwt.Client with module IO = Cohttp_lwt_unix_io and module Request = Request and module Response = Response and type ctx = Cohttp_lwt_unix_net.ctx
#
val custom_ctx : ?ctx:Conduit_lwt_unix.ctx -> ?resolver:Resolver_lwt.t -> unit -> ctx

custom_ctx ?ctx ?resolver () will return a 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.ctx 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).

end
#
module type S = sig

This module type defines the additional UNIX-specific functions that are exposed in addition to the Cohttp_lwt.Server interface. These are primarily filesystem functions, and also [root:create] to actually bind the server to a socket and respond to incoming requests.

include Cohttp_lwt.Server with module IO = Cohttp_lwt_unix_io and module Request = Request and module Response = Response and type ctx = Cohttp_lwt_unix_net.ctx
#
val resolve_file : docroot:string -> uri:Uri.t -> string
#
val respond_file : ?headers:Cohttp.Header.t -> fname:string -> unit -> (Cohttp.Response.t * Cohttp_lwt_body.t) Lwt.t
#
val create : ?timeout:int -> ?stop:unit Lwt.t -> ?ctx:Cohttp_lwt_unix_net.ctx -> ?mode:Conduit_lwt_unix.server -> t -> unit Lwt.t
end

Lwt-Unix Client and Server implementations

#
module Client : C

The Client module implements the full UNIX HTTP client interface, including the UNIX-specific functions defined in C.

#
module Server : S

The Server module implements the full UNIX HTTP server interface, including the UNIX-specific functions defined in S.

end