package shuttle_http

  1. Overview
  2. Docs
type error_handler = ?exn:exn -> ?request:Request.t -> Status.t -> Response.t Async.Deferred.t

error_handler can be used to customize how the server deals with any unhandled exceptions. A default implementation is provided that will respond with a status code and an empty response body.

module Ssl : sig ... end
module Config : sig ... end
type 'addr t
val sexp_of_t : ('addr -> Sexplib0.Sexp.t) -> 'addr t -> Sexplib0.Sexp.t
val peer_addr : 'addr t -> 'addr
val is_ssl : 'addr t -> bool
val ssl_peer_certificate : 'addr t -> Async_ssl.Ssl.Certificate.t Core.Or_error.t option
val ssl_version : 'addr t -> Async_ssl.Ssl.Version.t option
type 'addr service = 'addr t -> Request.t -> Response.t Async.Deferred.t

A user provided service that is invoked for every request/response cycle for a HTTP connection.

run_inet ?config addr service runs a http server where each request will be forwarded to the user provided service.

val run : ?config:Config.t -> ('address, 'listening_on) Async.Tcp.Where_to_listen.t -> 'address service -> ('address, 'listening_on) Async.Tcp.Server.t Async.Deferred.t

run ?config addr service runs a http server where each request will be forwarded to the user provided service.

OCaml

Innovation. Community. Security.