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
type response_action = [
| `Expert of Http.Response.t * (IO.ic -> IO.oc -> unit IO.t)
| `Response of response
]
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 -> response IO.t) -> unit -> t
val respond : ?headers:Http.Header.t -> status:Http.Status.t -> body:body -> unit -> response IO.t
val respond_string : ?headers:Http.Header.t -> status:Http.Status.t -> body:string -> unit -> response 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.
run server socket
socket