package cohttp-lwt

  1. Overview
  2. Docs

This functor keeps a cache of connections for reuse. Connections are reused based on their remote Conduit.endp (effectively IP / port). It also supports automatically connecting and reconnecting to direct and tunneling proxies, based on the remote URI scheme (HTTP will select direct proxies, HTTPS tunneling proxies).

Parameters

module Sleep : S.Sleep

Signature

include S.Connection_cache
type t
val call : t -> S.call

Process a request. Please see call.

val create : ?ctx:Connection.Net.ctx -> ?keep:int64 -> ?retry:int -> ?parallel:int -> ?depth:int -> ?scheme_proxy:(string * Uri.t) list -> ?all_proxy:Uri.t -> ?no_proxy:string -> ?proxy_headers:Http.Header.t -> unit -> t

Create a new connection cache. The outer connections to the proxy and the inner connections share the same parameters.

  • parameter keep

    Number of nanoseconds to keep an idle connection around.

  • parameter retry

    Number of times a gracefully failed request is automatically retried. graceful means failed with Connection.Retry. Requests with a `Stream Body cannot be retried automatically. Such requests will fail with Connection.Retry and a new Body will need to be provided to retry.

  • parameter parallel

    maximum number of connections to establish to a single endpoint. Beware: A single hostname may resolve to multiple endpoints. In such a case connections may be created in excess to what was intended.

  • parameter depth

    maximum number of requests to queue and / or send on a single connection.

  • parameter scheme_proxy

    The proxy URI associated to each (remote) scheme.

  • parameter all_proxy

    The default proxy to use. Proxy for specific schemes have precedence over this.

  • parameter no_proxy

    Disable proxies for specific hosts, specified as curl's NO_PROXY.

  • parameter proxy_headers

    Headers to pass to the proxy.

OCaml

Innovation. Community. Security.