package shuttle_http

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

Install

Dune Dependency

Authors

Maintainers

Sources

shuttle-0.9.2.tbz
sha256=69bf4d3ec9262dc981db5b6073c1d9e581c24fa1f1a49d20798eb3ae953ecdc3
sha512=36e95dcfce349f1acc586afa30c6b74d8212b9a8c0e32a2abcdbe09a87208b9ed2dc2c27aed3d65f4e9031260a3c54af7d0e9ebd7ba3d0b80182f17773dae24f

doc/shuttle_http/Shuttle_http/Client/index.html

Module Shuttle_http.ClientSource

Sourcemodule Address : sig ... end
Sourcemodule Ssl : sig ... end
Sourcetype t

HTTP/1.1 client that supports keep-alives. A client entity can be created once with an address and re-used for multiple requests. The client is closed either when a user explicitly closes it, or if there is an exception when performing a HTTP request using the client.

It is the responsiblity of the user to check that a http call raised an exception and avoid using a connection once an exception is seen in a call.

Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval create : ?interrupt:unit Async.Deferred.t -> ?connect_timeout:Core.Time.Span.t -> ?ssl:Ssl.t -> Address.t -> t Async.Deferred.Or_error.t

Initiate a TCP connection targeting the user provided Address and perform SSL handshake if needed. If an interrup deferred is provided the underlying socket is closed when it resolves. If address is a host + port pair the client will automatically populate the Host HTTP header for outgoing calls, and ensure that SNI and hostname validation is configured if using an SSL connection.

Sourceexception Remote_connection_closed

Remote_connection_closed is raised if attempting if an EOF is reached before the full response has been read.

Sourceexception Request_aborted

Request_aborted is raised if attempting to enqueue a request within a closed http client.

call Attempts to perform a HTTP request using the user provided client. If the response contains a "Connection: close" header or if there's an exception when performing the call the client will be closed and should not be used for any future calls. If performing multiple calls on a client, users should ensure to only wait on a response promise if all previous responses have been fully read.

Sourceval is_closed : t -> bool

is_closed returns if the client has been closed.

Sourceval closed : t -> unit Async.Deferred.t

closed returns a deferred that's resolved when the http client is closed.

Sourceval close : t -> unit Async.Deferred.t

close initiates shutdown for an http client. Any request that's currently in-flight will be attempt to run, and any pending requests will fail with exception.

Sourcemodule Oneshot : sig ... end
Sourcemodule Persistent : sig ... end

Persistent clients, not to be confused with HTTP/1.1 persistent connections are durable clients that maintain a connection to a service and eagerly and repeatedly reconnect if the underlying socket connection is lost.

OCaml

Innovation. Community. Security.