Module Picos_io_cohttp.Server

Convenience functions for processing requests and constructing responses.

Please consult the CoHTTP documentation.

include Cohttp.Generic.Server.S with type 'a IO.t = 'a with type IO.conn = Picos_io.Unix.file_descr with type body = Cohttp.Body.t
module IO : sig ... end
type body = Cohttp.Body.t
type conn = IO.conn * Cohttp__.Connection.t
type response_action = [
  1. | `Expert of Http.Response.t * (IO.ic -> IO.oc -> unit IO.t)
  2. | `Response of Http.Response.t * body
]
type t
val make_response_action : ?conn_closed:(conn -> unit) -> callback:(conn -> Http.Request.t -> body -> response_action IO.t) -> unit -> t
val make_expert : ?conn_closed:(conn -> unit) -> callback: (conn -> Http.Request.t -> body -> (Http.Response.t * (IO.ic -> IO.oc -> unit IO.t)) IO.t) -> unit -> t
val make : ?conn_closed:(conn -> unit) -> callback:(conn -> Http.Request.t -> body -> (Http.Response.t * body) IO.t) -> unit -> t
val respond : ?headers:Http.Header.t -> ?flush:bool -> status:Http.Status.t -> body:body -> unit -> (Http.Response.t * body) IO.t
val respond_string : ?headers:Http.Header.t -> ?flush:bool -> status:Http.Status.t -> body:string -> unit -> (Http.Response.t * body) IO.t
val callback : t -> IO.conn -> IO.ic -> IO.oc -> unit IO.t
val run : t -> IO.conn -> unit

run server socket starts running a server that accepts clients on the specified socket. This never returns normally.