module Multi:sig
..end
Curl multi stack. Functions may raise Failure
on critical errors
type
mt
type of Curl multi stack
type
curlPipelining =
| |
PIPE_NOTHING |
| |
PIPE_HTTP1 |
| |
PIPE_MULTIPLEX |
type
curlMultiOption =
| |
CURLMOPT_PIPELINING of |
| |
CURLMOPT_MAXCONNECTS of |
| |
CURLMOPT_MAX_PIPELINE_LENGTH of |
| |
CURLMOPT_MAX_HOST_CONNECTIONS of |
| |
CURLMOPT_MAX_TOTAL_CONNECTIONS of |
exception Error of string
exception raised on internal errors
type
cerror
exception CError of string * cerror * string
exception raised on libcurl errors : origin * code * message
val create : unit -> mt
create new multi stack
val add : mt -> Curl.t -> unit
add handle to multi stack
val remove : mt -> Curl.t -> unit
remove handle from multi stack (effectively halting the transfer)
val perform : mt -> int
perform pending data transfers (if any) on all handles currently in multi stack
val wait : ?timeout_ms:int -> mt -> bool
wait till there are some active data transfers on multi stack
perform
should be calledval poll : ?timeout_ms:int -> mt -> bool
poll till there are some active data transfers on multi stack.
Contrary to wait
, this function does not return immediately
when there are no pending transfer but waits for timeout_ms
The module falls back to wait
if this function is unavailable.
perform
should be calledval remove_finished : mt -> (Curl.t * Curl.curlCode) option
remove finished handle from the multi stack if any. The returned handle may be reused
val cleanup : mt -> unit
destroy multi handle (all transfers are stopped, but individual Curl.t
handles can be reused)
type
poll =
| |
POLL_NONE |
(* | none | *) |
| |
POLL_IN |
(* | available for reading | *) |
| |
POLL_OUT |
(* | available for writing | *) |
| |
POLL_INOUT |
(* | both | *) |
| |
POLL_REMOVE |
(* | socket not needed anymore | *) |
events that should be reported for the socket
type
fd_status =
| |
EV_AUTO |
(* | determine socket status automatically (with extra system call) | *) |
| |
EV_IN |
(* | socket has incoming data | *) |
| |
EV_OUT |
(* | socket is available for writing | *) |
| |
EV_INOUT |
(* | both | *) |
socket status
val set_socket_function : mt -> (Unix.file_descr -> poll -> unit) -> unit
set the function to receive notifications on what socket events are currently interesting for libcurl on the specified socket handle
val set_timer_function : mt -> (int -> unit) -> unit
set the function to receive notification when libcurl internal timeout changes, timeout value is in milliseconds
NB Curl.Multi.action_timeout
should be called when timeout occurs
val action_all : mt -> int
perform pending data transfers (if any) on all handles currently in multi stack
(not recommended, Curl.Multi.action
should be used instead)
Error
on errorsval action_timeout : mt -> unit
inform libcurl that timeout occured
Error
on errorsval action : mt -> Unix.file_descr -> fd_status -> int
action mt fd status
informs libcurl about event on the specified socket.
status
specifies socket status. Perform pending data transfers.
Error
on errorsval timeout : mt -> int
timeout mt
polls multi handle for timeout (not recommended, use Curl.Multi.set_timer_function
instead).
Error
on errorsval setopt : mt -> curlMultiOption -> unit
NotImplemented
for not implemented option