package ezcurl

  1. Overview
  2. Docs

Module Ezcurl_coreSource

Core signatures and implementation

Sourcemodule Config : sig ... end

Configuration for the client.

Sourcetype t = private {
  1. curl : Curl.t;
}

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

Sourceval 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)

Sourceval delete : t -> unit

Delete the client. It cannot be used anymore.

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

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

Sourceval set_no_signal : bool -> unit

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

  • since 0.3
Sourcemodule Cookies : sig ... end

Cookie handling.

Sourcetype 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.

Sourceval pp_response_info : Format.formatter -> response_info -> unit
Sourceval string_of_response_info : response_info -> string
Sourcetype 'body 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.

Sourceval pp_response_with : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a response -> unit
Sourceval pp_response : Format.formatter -> string response -> unit
Sourceval string_of_response : string response -> string
Sourcetype 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

Sourceval pp_meth : Format.formatter -> meth -> unit
Sourceval string_of_meth : meth -> string
Sourcemodule type IO = sig ... end
Sourcemodule type S = sig ... end
Sourcemodule Make (IO : IO) : S with type 'a io = 'a IO.t