Module Ezcurl_lwt

include module type of struct include Ezcurl_core end
module Config = Ezcurl_core.Config

Configuration for the client.

type t = private Ezcurl_core.t = {
  1. curl : Curl.t;
}

A client, i.e. a cURL instance. The wrapping record has been present since 0.3

val make : ?set_opts:(Curl.t -> unit) -> ?cookiejar_file:string -> ?enable_session_cookies:bool -> unit -> t

Create a new client.

  • parameter set_opts

    called before returning the client, to set options

  • parameter cookiejar_file

    if provided, tell curl to use the given file path to store/load cookies (since 0.3)

  • parameter enable_session_cookies

    if provided, enable cookie handling in curl so it store/load cookies (since 0.3)

val delete : t -> unit

Delete the client. It cannot be used anymore.

val with_client : ?set_opts:(Curl.t -> unit) -> (t -> 'a) -> 'a

Make a temporary client, call the function with it, then cleanup.

val set_no_signal : bool -> unit

Set no_signal default value for each new client instance. Default is true. See CURLOPT_NOSIGNAL.

  • since 0.3
module Cookies = Ezcurl_core.Cookies

Cookie handling.

type response_info = Ezcurl_core.response_info = {
  1. ri_response_time : float;
    (*

    Total time (in seconds) for the request/response pair. See Curl.get_totaltime.

    *)
  2. ri_redirect_count : int;
    (*

    Number of redirects cURL followed. See Curl.get_redirectcount.

    *)
}

Metadata about a response from the server.

val pp_response_info : Stdlib.Format.formatter -> response_info -> unit
val string_of_response_info : response_info -> string
type 'body response = 'body Ezcurl_core.response = {
  1. code : int;
    (*

    Response code. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

    *)
  2. headers : (string * string) list;
    (*

    Response headers

    *)
  3. body : 'body;
    (*

    Response body, or ""

    *)
  4. info : response_info;
    (*

    Information about the response

    *)
}

Response for a given request.

val pp_response_with : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a response -> unit
val pp_response : Stdlib.Format.formatter -> string response -> unit
val string_of_response : string response -> string
type meth = Ezcurl_core.meth =
  1. | GET
  2. | POST of Curl.curlHTTPPost list
  3. | PUT
  4. | DELETE
  5. | HEAD
  6. | CONNECT
  7. | OPTIONS
  8. | TRACE
  9. | PATCH

The HTTP method to use

val pp_meth : Stdlib.Format.formatter -> meth -> unit
val string_of_meth : meth -> string
module type IO = Ezcurl_core.IO
module type S = Ezcurl_core.S
module Make = Ezcurl_core.Make
include sig ... end
type 'a io = 'a Lwt.t
val http : ?tries:int -> ?client:Ezcurl_core.t -> ?config:Ezcurl_core.Config.t -> ?range:string -> ?content:[ `String of string | `Write of bytes -> int -> int ] -> ?headers:(string * string) list -> url:string -> meth:Ezcurl_core.meth -> unit -> (string Ezcurl_core.response, Curl.curlCode * string) Stdlib.result io
class type input_stream = object ... end
val http_stream : ?tries:int -> ?client:Ezcurl_core.t -> ?config:Ezcurl_core.Config.t -> ?range:string -> ?content:[ `String of string | `Write of bytes -> int -> int ] -> ?headers:(string * string) list -> url:string -> meth:Ezcurl_core.meth -> write_into:input_stream -> unit -> (unit Ezcurl_core.response, Curl.curlCode * string) Stdlib.result io
val get : ?tries:int -> ?client:Ezcurl_core.t -> ?config:Ezcurl_core.Config.t -> ?range:string -> ?headers:(string * string) list -> url:string -> unit -> (string Ezcurl_core.response, Curl.curlCode * string) Stdlib.result io
val put : ?tries:int -> ?client:Ezcurl_core.t -> ?config:Ezcurl_core.Config.t -> ?headers:(string * string) list -> url:string -> content:[ `String of string | `Write of bytes -> int -> int ] -> unit -> (string Ezcurl_core.response, Curl.curlCode * string) Stdlib.result io
val post : ?tries:int -> ?client:Ezcurl_core.t -> ?config:Ezcurl_core.Config.t -> ?headers:(string * string) list -> ?content:[ `String of string | `Write of bytes -> int -> int ] -> params:Curl.curlHTTPPost list -> url:string -> unit -> (string Ezcurl_core.response, Curl.curlCode * string) Stdlib.result io