package cohttp-mirage

  1. Overview
  2. Docs

Module Make.ConnectionSource

Sourceexception Retry
Sourcetype t
Sourceval create : ?finalise:(t -> unit Net.IO.t) -> ?persistent:bool -> ?ctx:Net.ctx -> Net.endp -> t

create ?finalise ?persistent ?ctx endp connects to endp. The connection handle may be used immediately, although the connection may not yet be established.

  • parameter finalise

    called when the connection is closed, but before still waiting requests are failed.

  • parameter persistent

    if false, a Connection: close header is sent and the connection closed as soon as possible. If true, it is assumed the remote end does support pipelining and multiple requests may be sent even before receiving any reply. By default we wait for the first response to decide whether connection keep-alive and pipelining is supported. Chunked encoding can only be used when pipelining is supported. Therefore better avoid using chunked encoding on the very first request.

  • parameter ctx

    See Net.ctx

  • parameter endp

    The remote address, port and protocol to connect to.

Sourceval create_tunnel : ?finalise:(t -> unit Net.IO.t) -> ?ctx:Net.ctx -> t -> string -> t
Sourceval connect : ?finalise:(t -> unit Net.IO.t) -> ?persistent:bool -> ?ctx:Net.ctx -> Net.endp -> t Net.IO.t

Same as create, but returns d promise which gets fulfilled when the connection is established or rejected when connecting fails.

Sourceval shutdown : t -> unit

Send EOF. On TCP connections send a FIN packet. On TLS connections send a close notify. No new requests can be sent afterwards, but responses may still be received.

Sourceval close : t -> unit

Immediately close connection. All outstanding requests will fail, but non-idempotent requests that already went out on the wire may have produced side-effects.

Sourceval is_closed : t -> bool

If is_closed connection is false the connection still accepts new requests.

Sourceval length : t -> int

Number of unfulfilled requests. This includes requests already sent out and requests still waitung to be sent.

Sourceval notify : t -> unit Net.IO.t

Request notification on change of length and on closing.

Queue a request. Please see requester.

OCaml

Innovation. Community. Security.