package http_async

  1. Overview
  2. Docs
Async library for HTTP/1.1 servers

Install

Dune Dependency

Authors

Maintainers

Sources

http_async-0.2.0.tbz
sha256=3ba4a210833e93a50ca2e539b38d29352f7c1b892fd7b7e89af4e788fafe905f
sha512=0bf256e969a49d45765f8b0e1a06d914c2bc45c4d6f4adc28ad4d2f68f52734b3de73e890a9b5501c8679fdca30191663372a5786e693d505b1640554068af94

doc/http_async/Http_async/Server/index.html

Module Http_async.ServerSource

Sourcetype error_handler = ?exn:Core.Exn.t -> ?request:Request.t -> Status.t -> (Response.t * Body.Writer.t) Async.Deferred.t
Sourceval run_server_loop : ?error_handler:error_handler -> ((Request.t * Body.Reader.t) -> (Response.t * Body.Writer.t) Async.Deferred.t) -> Shuttle.Input_channel.t -> Shuttle.Output_channel.t -> unit Async.Deferred.t

run_server_loop accepts a HTTP service, and returns a callback that can be used to drive the server loop created via Shuttle.Connection.listen. This allows the user to customize the Input_channel and Output_channel and have control over the various Server configuration options like accept_n, backlog and more.

Sourceval run : ?max_connections:int -> ?max_accepts_per_batch:int -> ?backlog:int -> ?socket:([ `Unconnected ], [< Async.Socket.Address.t ] as 'a) Async.Socket.t -> ?buffer_config:Buffer_config.t -> ?error_handler:('a -> error_handler) -> where_to_listen:('a, 'b) Async.Tcp.Where_to_listen.t -> ('a -> (Request.t * Body.Reader.t) -> (Response.t * Body.Writer.t) Async.Deferred.t) -> ('a, 'b) Async.Tcp.Server.t Async.Deferred.t

run sets up a Tcp.Server.t and drives the HTTP server loop with the user provided request-handler.

Sourceval run_command : ?interrupt:unit Async.Deferred.t -> ?readme:(unit -> string) -> ?error_handler:(Async.Socket.Address.Inet.t -> error_handler) -> summary:string -> (Async.Socket.Address.Inet.t -> (Request.t * Body.Reader.t) -> (Response.t * Body.Writer.t) Async.Deferred.t) -> Async.Command.t

run_command is similar to run but instead returns an Async.Command.t that can be used to start the async event loop from a program's entrypoint. If interrupt is provided, the server will be stopped when interrupt is fulfilled.

OCaml

Innovation. Community. Security.