make CURLOPT_SSLVERSION an enum (breaking change, closes #16)
[ocurl.git] / curl.mli
blob73b3d0e6f826f0447a1afb0aa708b9817376a789
1 (*
2 * curl.mli
4 * Copyright (c) 2003-2008, Lars Nilsson, <lars@quantumchamaeleon.com>
5 * Copyright (c) 2009, ygrek, <ygrek@autistici.org>
6 *)
8 (** libcurl wrapper *)
10 (** {2 Types} *)
12 type t
14 type curlCode =
15 | CURLE_OK
16 | CURLE_UNSUPPORTED_PROTOCOL
17 | CURLE_FAILED_INIT
18 | CURLE_URL_MALFORMAT
19 | CURLE_URL_MALFORMAT_USER
20 | CURLE_COULDNT_RESOLVE_PROXY
21 | CURLE_COULDNT_RESOLVE_HOST
22 | CURLE_COULDNT_CONNECT
23 | CURLE_FTP_WEIRD_SERVER_REPLY
24 | CURLE_FTP_ACCESS_DENIED
25 | CURLE_FTP_USER_PASSWORD_INCORRECT
26 | CURLE_FTP_WEIRD_PASS_REPLY
27 | CURLE_FTP_WEIRD_USER_REPLY
28 | CURLE_FTP_WEIRD_PASV_REPLY
29 | CURLE_FTP_WEIRD_227_FORMAT
30 | CURLE_FTP_CANT_GET_HOST
31 | CURLE_FTP_CANT_RECONNECT
32 | CURLE_FTP_COULDNT_SET_BINARY
33 | CURLE_PARTIAL_FILE
34 | CURLE_FTP_COULDNT_RETR_FILE
35 | CURLE_FTP_WRITE_ERROR
36 | CURLE_FTP_QUOTE_ERROR
37 | CURLE_HTTP_NOT_FOUND
38 | CURLE_WRITE_ERROR
39 | CURLE_MALFORMAT_USER
40 | CURLE_FTP_COULDNT_STOR_FILE
41 | CURLE_READ_ERROR
42 | CURLE_OUT_OF_MEMORY
43 | CURLE_OPERATION_TIMEOUTED
44 | CURLE_FTP_COULDNT_SET_ASCII
45 | CURLE_FTP_PORT_FAILED
46 | CURLE_FTP_COULDNT_USE_REST
47 | CURLE_FTP_COULDNT_GET_SIZE
48 | CURLE_HTTP_RANGE_ERROR
49 | CURLE_HTTP_POST_ERROR
50 | CURLE_SSL_CONNECT_ERROR
51 | CURLE_FTP_BAD_DOWNLOAD_RESUME
52 | CURLE_FILE_COULDNT_READ_FILE
53 | CURLE_LDAP_CANNOT_BIND
54 | CURLE_LDAP_SEARCH_FAILED
55 | CURLE_LIBRARY_NOT_FOUND
56 | CURLE_FUNCTION_NOT_FOUND
57 | CURLE_ABORTED_BY_CALLBACK
58 | CURLE_BAD_FUNCTION_ARGUMENT
59 | CURLE_BAD_CALLING_ORDER
60 | CURLE_HTTP_PORT_FAILED
61 | CURLE_BAD_PASSWORD_ENTERED
62 | CURLE_TOO_MANY_REDIRECTS
63 | CURLE_UNKNOWN_TELNET_OPTION
64 | CURLE_TELNET_OPTION_SYNTAX
65 | CURLE_OBSOLETE
66 | CURLE_SSL_PEER_CERTIFICATE
67 | CURLE_GOT_NOTHING
68 | CURLE_SSL_ENGINE_NOTFOUND
69 | CURLE_SSL_ENGINE_SETFAILED
70 | CURLE_SEND_ERROR
71 | CURLE_RECV_ERROR
72 | CURLE_SHARE_IN_USE
73 | CURLE_SSL_CERTPROBLEM
74 | CURLE_SSL_CIPHER
75 | CURLE_SSL_CACERT
76 | CURLE_BAD_CONTENT_ENCODING
77 | CURLE_LDAP_INVALID_URL
78 | CURLE_FILESIZE_EXCEEDED
79 | CURLE_USE_SSL_FAILED
80 | CURLE_SEND_FAIL_REWIND
81 | CURLE_SSL_ENGINE_INITFAILED
82 | CURLE_LOGIN_DENIED
83 | CURLE_TFTP_NOTFOUND
84 | CURLE_TFTP_PERM
85 | CURLE_REMOTE_DISK_FULL
86 | CURLE_TFTP_ILLEGAL
87 | CURLE_TFTP_UNKNOWNID
88 | CURLE_REMOTE_FILE_EXISTS
89 | CURLE_TFTP_NOSUCHUSER
90 | CURLE_CONV_FAILED
91 | CURLE_CONV_REQD
92 | CURLE_SSL_CACERT_BADFILE
93 | CURLE_REMOTE_FILE_NOT_FOUND
94 | CURLE_SSH
95 | CURLE_SSL_SHUTDOWN_FAILED
96 | CURLE_AGAIN
98 exception CurlException of (curlCode * int * string)
100 (** exception raised when trying to use options missing from libcurl headers,
101 argument is the option name *)
102 exception NotImplemented of string
104 type curlNETRCOption =
105 | CURL_NETRC_OPTIONAL
106 | CURL_NETRC_IGNORED
107 | CURL_NETRC_REQUIRED
109 type curlEncoding =
110 | CURL_ENCODING_NONE (* identity *)
111 | CURL_ENCODING_DEFLATE (* deflate *)
112 | CURL_ENCODING_GZIP (* gzip *)
113 | CURL_ENCODING_ANY (* all supported encodings *)
115 type curlContentType =
116 | DEFAULT
117 | CONTENTTYPE of string
119 type curlHTTPPost =
120 | CURLFORM_CONTENT of string * string * curlContentType
121 | CURLFORM_FILECONTENT of string * string * curlContentType
122 | CURLFORM_FILE of string * string * curlContentType
123 | CURLFORM_BUFFER of string * string * string * curlContentType
126 type curlHTTPPost =
127 | CURLFORM_COPYNAME of string
128 | CURLFORM_PTRNAME of string
129 | CURLFORM_NAMELENGTH of int
130 | CURLFORM_COPYCONTENTS of string
131 | CURLFORM_PTRCONTENTS of string
132 | CURLFORM_FILE of string
133 | CURLFORM_FILECONTENT of string
134 | CURLFORM_CONTENTSLENGTH of int
135 | CURLFORM_CONTENTTYPE of string
138 type curlSSLVersion =
139 | SSLVERSION_DEFAULT (** attempt to figure out the remote SSL protocol version *)
140 | SSLVERSION_TLSv1 (** TLSv1.x *)
141 | SSLVERSION_SSLv2 (** SSLv2 *)
142 | SSLVERSION_SSLv3 (** SSLv3 *)
143 | SSLVERSION_TLSv1_0 (** Added in 7.34.0 *)
144 | SSLVERSION_TLSv1_1 (** Added in 7.34.0 *)
145 | SSLVERSION_TLSv1_2 (** Added in 7.34.0 *)
147 type curlTimeCondition =
148 | TIMECOND_NONE (** since 0.6.1 *)
149 | TIMECOND_IFMODSINCE
150 | TIMECOND_IFUNMODSINCE
151 | TIMECOND_LASTMOD (** since 0.6.1 *)
153 type curlKRB4Level =
154 | KRB4_NONE
155 | KRB4_CLEAR
156 | KRB4_SAFE
157 | KRB4_CONFIDENTIAL
158 | KRB4_PRIVATE
160 type curlClosePolicy =
161 | CLOSEPOLICY_OLDEST
162 | CLOSEPOLICY_LEAST_RECENTLY_USED
164 type curlSSLVerifyHost =
165 | SSLVERIFYHOST_NONE (** connection succeeds regardless of the names in the certificate *)
166 | SSLVERIFYHOST_EXISTENCE (** deprecated, equivalent to SSLVERIFYHOST_HOSTNAME *)
167 | SSLVERIFYHOST_HOSTNAME (** certificate must indicate the matching hostname, or the connection fails *)
169 type curlHTTPVersion =
170 | HTTP_VERSION_NONE (** libcurl will make the best choice *)
171 | HTTP_VERSION_1_0 (** please use HTTP 1.0 *)
172 | HTTP_VERSION_1_1 (** please use HTTP 1.1 *)
173 | HTTP_VERSION_2 (** please use HTTP 2 *)
174 | HTTP_VERSION_2TLS (** use version 2 for HTTPS, version 1.1 for HTTP *)
176 type curlDebugType =
177 | DEBUGTYPE_TEXT
178 | DEBUGTYPE_HEADER_IN
179 | DEBUGTYPE_HEADER_OUT
180 | DEBUGTYPE_DATA_IN
181 | DEBUGTYPE_DATA_OUT
182 | DEBUGTYPE_END
184 type curlAuth =
185 | CURLAUTH_BASIC
186 | CURLAUTH_DIGEST
187 | CURLAUTH_GSSNEGOTIATE
188 | CURLAUTH_NTLM
189 | CURLAUTH_ANY
190 | CURLAUTH_ANYSAFE
192 type curlIPResolve =
193 | IPRESOLVE_WHATEVER
194 | IPRESOLVE_V4
195 | IPRESOLVE_V6
197 type curlFTPSSL =
198 | FTPSSL_NONE
199 | FTPSSL_TRY
200 | FTPSSL_CONTROL
201 | FTPSSL_ALL
203 type curlFTPSSLAuth =
204 | FTPAUTH_DEFAULT
205 | FTPAUTH_SSL
206 | FTPAUTH_TLS
208 type curlIOCmd =
209 | IOCMD_NOP
210 | IOCMD_RESTARTREAD
212 type curlIOErr =
213 | IOE_OK
214 | IOE_UNKNOWNCMD
215 | IOE_FAILRESTART
217 type curlSeekResult =
218 | SEEKFUNC_OK
219 | SEEKFUNC_FAIL
220 | SEEKFUNC_CANTSEEK
222 type curlFTPMethod =
223 | FTPMETHOD_DEFAULT
224 | FTPMETHOD_MULTICWD
225 | FTPMETHOD_NOCWD
226 | FTPMETHOD_SINGLECWD
228 type curlSSHAuthTypes =
229 | SSHAUTH_ANY
230 | SSHAUTH_PUBLICKEY
231 | SSHAUTH_PASSWORD
232 | SSHAUTH_HOST
233 | SSHAUTH_KEYBOARD
235 type curlFTPSSLCCC =
236 | FTPSSL_CCC_NONE
237 | FTPSSL_CCC_PASSIVE
238 | FTPSSL_CCC_ACTIVE
240 type curlSeek =
241 | SEEK_SET
242 | SEEK_CUR
243 | SEEK_END
245 type curlProxyType =
246 | CURLPROXY_HTTP
247 | CURLPROXY_HTTP_1_0 (** since libcurl 7.19.4 *)
248 | CURLPROXY_SOCKS4 (** since libcurl 7.15.2 *)
249 | CURLPROXY_SOCKS5
250 | CURLPROXY_SOCKS4A (** since libcurl 7.18.0 *)
251 | CURLPROXY_SOCKS5_HOSTNAME (** since libcurl 7.18.0 *)
253 (** Protocols to enable (via CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS) *)
254 type curlProto =
255 | CURLPROTO_ALL (** enable everything *)
256 | CURLPROTO_HTTP
257 | CURLPROTO_HTTPS
258 | CURLPROTO_FTP
259 | CURLPROTO_FTPS
260 | CURLPROTO_SCP
261 | CURLPROTO_SFTP
262 | CURLPROTO_TELNET
263 | CURLPROTO_LDAP
264 | CURLPROTO_LDAPS
265 | CURLPROTO_DICT
266 | CURLPROTO_FILE
267 | CURLPROTO_TFTP
268 | CURLPROTO_IMAP
269 | CURLPROTO_IMAPS
270 | CURLPROTO_POP3
271 | CURLPROTO_POP3S
272 | CURLPROTO_SMTP
273 | CURLPROTO_SMTPS
274 | CURLPROTO_RTSP
275 | CURLPROTO_RTMP
276 | CURLPROTO_RTMPT
277 | CURLPROTO_RTMPE
278 | CURLPROTO_RTMPTE
279 | CURLPROTO_RTMPS
280 | CURLPROTO_RTMPTS
281 | CURLPROTO_GOPHER
283 type curlOption =
284 | CURLOPT_WRITEFUNCTION of (string -> int)
285 | CURLOPT_READFUNCTION of (int -> string)
286 | CURLOPT_INFILESIZE of int
287 | CURLOPT_URL of string
288 | CURLOPT_PROXY of string
289 | CURLOPT_PROXYPORT of int
290 | CURLOPT_HTTPPROXYTUNNEL of bool
291 | CURLOPT_VERBOSE of bool
292 | CURLOPT_HEADER of bool
293 | CURLOPT_NOPROGRESS of bool
294 | CURLOPT_NOSIGNAL of bool
295 | CURLOPT_NOBODY of bool
296 | CURLOPT_FAILONERROR of bool
297 | CURLOPT_UPLOAD of bool
298 | CURLOPT_POST of bool
299 | CURLOPT_FTPLISTONLY of bool
300 | CURLOPT_FTPAPPEND of bool
301 | CURLOPT_NETRC of curlNETRCOption
302 | CURLOPT_ENCODING of curlEncoding
303 | CURLOPT_FOLLOWLOCATION of bool
304 | CURLOPT_TRANSFERTEXT of bool
305 | CURLOPT_PUT of bool
306 | CURLOPT_USERPWD of string
307 | CURLOPT_PROXYUSERPWD of string
308 | CURLOPT_RANGE of string
309 | CURLOPT_ERRORBUFFER of string ref
310 | CURLOPT_TIMEOUT of int
311 | CURLOPT_POSTFIELDS of string
312 | CURLOPT_POSTFIELDSIZE of int
313 | CURLOPT_REFERER of string
314 | CURLOPT_USERAGENT of string
315 | CURLOPT_FTPPORT of string
316 | CURLOPT_LOWSPEEDLIMIT of int
317 | CURLOPT_LOWSPEEDTIME of int
318 | CURLOPT_RESUMEFROM of int
319 | CURLOPT_COOKIE of string
320 | CURLOPT_HTTPHEADER of string list
321 | CURLOPT_HTTPPOST of curlHTTPPost list
322 | CURLOPT_SSLCERT of string
323 | CURLOPT_SSLCERTTYPE of string
324 | CURLOPT_SSLCERTPASSWD of string
325 | CURLOPT_SSLKEY of string
326 | CURLOPT_SSLKEYTYPE of string
327 | CURLOPT_SSLKEYPASSWD of string
328 | CURLOPT_SSLENGINE of string
329 | CURLOPT_SSLENGINEDEFAULT of bool
330 | CURLOPT_CRLF of bool
331 | CURLOPT_QUOTE of string list
332 | CURLOPT_POSTQUOTE of string list
333 | CURLOPT_HEADERFUNCTION of (string -> int)
334 | CURLOPT_COOKIEFILE of string
335 | CURLOPT_SSLVERSION of curlSSLVersion
336 | CURLOPT_TIMECONDITION of curlTimeCondition
337 | CURLOPT_TIMEVALUE of int32
338 | CURLOPT_CUSTOMREQUEST of string
339 | CURLOPT_INTERFACE of string
340 | CURLOPT_KRB4LEVEL of curlKRB4Level
341 | CURLOPT_PROGRESSFUNCTION of (float -> float -> float -> float -> bool)
342 | CURLOPT_SSLVERIFYPEER of bool
343 | CURLOPT_CAINFO of string
344 | CURLOPT_CAPATH of string
345 | CURLOPT_FILETIME of bool
346 | CURLOPT_MAXREDIRS of int
347 | CURLOPT_MAXCONNECTS of int
348 | CURLOPT_CLOSEPOLICY of curlClosePolicy
349 | CURLOPT_FRESHCONNECT of bool
350 | CURLOPT_FORBIDREUSE of bool
351 | CURLOPT_RANDOMFILE of string
352 | CURLOPT_EGDSOCKET of string
353 | CURLOPT_CONNECTTIMEOUT of int
354 | CURLOPT_HTTPGET of bool
355 | CURLOPT_SSLVERIFYHOST of curlSSLVerifyHost
356 | CURLOPT_COOKIEJAR of string
357 | CURLOPT_SSLCIPHERLIST of string
358 | CURLOPT_HTTPVERSION of curlHTTPVersion
359 | CURLOPT_FTPUSEEPSV of bool
360 | CURLOPT_DNSCACHETIMEOUT of int
361 | CURLOPT_DNSUSEGLOBALCACHE of bool
362 | CURLOPT_DEBUGFUNCTION of (t -> curlDebugType -> string -> unit)
363 | CURLOPT_PRIVATE of string
364 | CURLOPT_HTTP200ALIASES of string list
365 | CURLOPT_UNRESTRICTEDAUTH of bool
366 | CURLOPT_FTPUSEEPRT of bool
367 | CURLOPT_HTTPAUTH of curlAuth list
368 | CURLOPT_FTPCREATEMISSINGDIRS of bool
369 | CURLOPT_PROXYAUTH of curlAuth list
370 | CURLOPT_FTPRESPONSETIMEOUT of int
371 | CURLOPT_IPRESOLVE of curlIPResolve
372 | CURLOPT_MAXFILESIZE of int32
373 | CURLOPT_INFILESIZELARGE of int64
374 | CURLOPT_RESUMEFROMLARGE of int64
375 | CURLOPT_MAXFILESIZELARGE of int64
376 | CURLOPT_NETRCFILE of string
377 | CURLOPT_FTPSSL of curlFTPSSL
378 | CURLOPT_POSTFIELDSIZELARGE of int64
379 | CURLOPT_TCPNODELAY of bool
380 | CURLOPT_FTPSSLAUTH of curlFTPSSLAuth
381 | CURLOPT_IOCTLFUNCTION of (t -> curlIOCmd -> curlIOErr)
382 | CURLOPT_FTPACCOUNT of string
383 | CURLOPT_COOKIELIST of string
384 | CURLOPT_IGNORECONTENTLENGTH of bool
385 | CURLOPT_FTPSKIPPASVIP of bool
386 | CURLOPT_FTPFILEMETHOD of curlFTPMethod
387 | CURLOPT_LOCALPORT of int
388 | CURLOPT_LOCALPORTRANGE of int
389 | CURLOPT_CONNECTONLY of bool
390 | CURLOPT_MAXSENDSPEEDLARGE of int64
391 | CURLOPT_MAXRECVSPEEDLARGE of int64
392 | CURLOPT_FTPALTERNATIVETOUSER of string
393 | CURLOPT_SSLSESSIONIDCACHE of bool
394 | CURLOPT_SSHAUTHTYPES of curlSSHAuthTypes list
395 | CURLOPT_SSHPUBLICKEYFILE of string
396 | CURLOPT_SSHPRIVATEKEYFILE of string
397 | CURLOPT_FTPSSLCCC of curlFTPSSLCCC
398 | CURLOPT_TIMEOUTMS of int
399 | CURLOPT_CONNECTTIMEOUTMS of int
400 | CURLOPT_HTTPTRANSFERDECODING of bool
401 | CURLOPT_HTTPCONTENTDECODING of bool
402 | CURLOPT_NEWFILEPERMS of int
403 | CURLOPT_NEWDIRECTORYPERMS of int
404 | CURLOPT_POST301 of bool
405 | CURLOPT_SSHHOSTPUBLICKEYMD5 of string
406 | CURLOPT_COPYPOSTFIELDS of string
407 | CURLOPT_PROXYTRANSFERMODE of bool
408 | CURLOPT_SEEKFUNCTION of (int64 -> curlSeek -> curlSeekResult)
409 | CURLOPT_AUTOREFERER of bool
410 | CURLOPT_OPENSOCKETFUNCTION of (Unix.file_descr -> unit)
411 | CURLOPT_PROXYTYPE of curlProxyType
412 | CURLOPT_PROTOCOLS of curlProto list
413 | CURLOPT_REDIR_PROTOCOLS of curlProto list
414 | CURLOPT_RESOLVE of string list
415 | CURLOPT_DNS_SERVERS of string
416 | CURLOPT_MAIL_FROM of string
417 | CURLOPT_MAIL_RCPT of string list
418 | CURLOPT_PIPEWAIT of bool
419 | CURLOPT_CERTINFO of bool
421 type initOption =
422 | CURLINIT_GLOBALALL
423 | CURLINIT_GLOBALSSL
424 | CURLINIT_GLOBALWIN32
425 | CURLINIT_GLOBALNOTHING
427 type curlInfo =
428 | CURLINFO_EFFECTIVE_URL
429 | CURLINFO_HTTP_CODE
430 | CURLINFO_RESPONSE_CODE
431 | CURLINFO_TOTAL_TIME
432 | CURLINFO_NAMELOOKUP_TIME
433 | CURLINFO_CONNECT_TIME
434 | CURLINFO_PRETRANSFER_TIME
435 | CURLINFO_SIZE_UPLOAD
436 | CURLINFO_SIZE_DOWNLOAD
437 | CURLINFO_SPEED_DOWNLOAD
438 | CURLINFO_SPEED_UPLOAD
439 | CURLINFO_HEADER_SIZE
440 | CURLINFO_REQUEST_SIZE
441 | CURLINFO_SSL_VERIFYRESULT
442 | CURLINFO_FILETIME
443 | CURLINFO_CONTENT_LENGTH_DOWNLOAD
444 | CURLINFO_CONTENT_LENGTH_UPLOAD
445 | CURLINFO_STARTTRANSFER_TIME
446 | CURLINFO_CONTENT_TYPE
447 | CURLINFO_REDIRECT_TIME
448 | CURLINFO_REDIRECT_COUNT
449 | CURLINFO_PRIVATE
450 | CURLINFO_HTTP_CONNECTCODE
451 | CURLINFO_HTTPAUTH_AVAIL
452 | CURLINFO_PROXYAUTH_AVAIL
453 | CURLINFO_OS_ERRNO
454 | CURLINFO_NUM_CONNECTS
455 | CURLINFO_SSL_ENGINES
456 | CURLINFO_COOKIELIST
457 | CURLINFO_LASTSOCKET
458 | CURLINFO_FTP_ENTRY_PATH
459 | CURLINFO_REDIRECT_URL
460 | CURLINFO_PRIMARY_IP
461 | CURLINFO_LOCAL_IP
462 | CURLINFO_LOCAL_PORT
463 | CURLINFO_CONDITION_UNMET
464 | CURLINFO_CERTINFO
466 type curlInfoResult =
467 | CURLINFO_String of string
468 | CURLINFO_Long of int
469 | CURLINFO_Double of float
470 | CURLINFO_StringList of string list
471 | CURLINFO_StringListList of string list list
473 type version_info = {
474 version : string;
475 number : int * int * int;
476 host : string;
477 features : string list;
478 ssl_version : string option;
479 libz_version : string option;
480 protocols : string list;
481 ares : string; (** starting from this field are optional features - may be empty/zero *)
482 ares_num : int;
483 libidn : string;
484 iconv_ver_num : int;
485 libssh_version : string;
488 type pauseOption = PAUSE_SEND | PAUSE_RECV | PAUSE_ALL
490 (** {2 curl_easy API} *)
492 val global_init : initOption -> unit
493 val global_cleanup : unit -> unit
494 val init : unit -> t
495 val reset : t -> unit
496 (** Reset [t] to the default state *)
497 val duphandle : t -> t
498 (** Create the new handle, copying all the options from the supplied [t].
499 Note that it will also copy [set_writefunction] options and alike, as such both
500 handles (original and new one) will be referencing the same closures, potentially
501 sharing some state, which may lead to surprising results. *)
502 val setopt : t -> curlOption -> unit
503 (** @raise NotImplemented for not implemented option *)
504 val perform : t -> unit
505 val cleanup : t -> unit
506 val getinfo : t -> curlInfo -> curlInfoResult
507 val escape : string -> string
508 val unescape : string -> string
509 val getdate : string -> float -> float
510 val version : unit -> string
511 val strerror : curlCode -> string
512 val errno : curlCode -> int
513 val version_info : unit -> version_info
514 val pause : t -> pauseOption list -> unit
516 (** {2 Set transfer options}
518 All callback functions shouldn't raise exceptions.
519 Any exception raised in callback function will be silently caught and discared,
520 and transfer will be aborted. *)
522 val set_writefunction : t -> (string -> int) -> unit
523 val set_readfunction : t -> (int -> string) -> unit
524 (** [readfunction n] should return string of length at most [n], otherwise
525 transfer will be aborted (as if with exception) *)
526 val set_infilesize : t -> int -> unit
527 val set_url : t -> string -> unit
528 val set_proxy : t -> string -> unit
529 val set_proxyport : t -> int -> unit
530 val set_httpproxytunnel : t -> bool -> unit
531 val set_verbose : t -> bool -> unit
532 val set_header : t -> bool -> unit
533 val set_noprogress : t -> bool -> unit
534 val set_nosignal : t -> bool -> unit
535 val set_nobody : t -> bool -> unit
536 val set_failonerror : t -> bool -> unit
537 val set_upload : t -> bool -> unit
538 val set_post : t -> bool -> unit
539 val set_ftplistonly : t -> bool -> unit
540 val set_ftpappend : t -> bool -> unit
541 val set_netrc : t -> curlNETRCOption -> unit
542 val set_encoding : t -> curlEncoding -> unit
543 val set_followlocation : t -> bool -> unit
544 val set_transfertext : t -> bool -> unit
545 val set_put : t -> bool -> unit
546 val set_userpwd : t -> string -> unit
547 val set_proxyuserpwd : t -> string -> unit
548 val set_range : t -> string -> unit
549 val set_errorbuffer : t -> string ref -> unit
550 val set_timeout : t -> int -> unit
551 val set_postfields : t -> string -> unit
552 val set_postfieldsize : t -> int -> unit
553 val set_referer : t -> string -> unit
554 val set_useragent : t -> string -> unit
555 val set_ftpport : t -> string -> unit
556 val set_lowspeedlimit : t -> int -> unit
557 val set_lowspeedtime : t -> int -> unit
558 val set_resumefrom : t -> int -> unit
559 val set_cookie : t -> string -> unit
560 val set_httpheader : t -> string list -> unit
561 val set_httppost : t -> curlHTTPPost list -> unit
562 val set_sslcert : t -> string -> unit
563 val set_sslcerttype : t -> string -> unit
564 val set_sslcertpasswd : t -> string -> unit
565 val set_sslkey : t -> string -> unit
566 val set_sslkeytype : t -> string -> unit
567 val set_sslkeypasswd : t -> string -> unit
568 val set_sslengine : t -> string -> unit
569 val set_sslenginedefault : t -> bool -> unit
570 val set_certinfo : t -> bool -> unit
571 val set_crlf : t -> bool -> unit
572 val set_quote : t -> string list -> unit
573 val set_postquote : t -> string list -> unit
574 val set_headerfunction: t -> (string -> int) -> unit
575 val set_cookiefile : t -> string -> unit
576 val set_sslversion : t -> curlSSLVersion -> unit
577 val set_timecondition : t -> curlTimeCondition -> unit
578 val set_timevalue : t -> int32 -> unit
579 val set_customrequest : t -> string -> unit
580 val set_interface : t -> string -> unit
581 val set_krb4level : t -> curlKRB4Level -> unit
582 val set_progressfunction : t -> (float -> float -> float -> float -> bool) -> unit
583 val set_sslverifypeer : t -> bool -> unit
584 val set_cainfo : t -> string -> unit
585 val set_capath : t -> string -> unit
586 val set_filetime : t -> bool -> unit
587 val set_maxredirs : t -> int -> unit
588 val set_maxconnects : t -> int -> unit
589 val set_closepolicy : t -> curlClosePolicy -> unit
590 val set_freshconnect : t -> bool -> unit
591 val set_forbidreuse : t -> bool -> unit
592 val set_randomfile : t -> string -> unit
593 val set_egdsocket : t -> string -> unit
594 val set_connecttimeout : t -> int -> unit
595 val set_httpget : t -> bool -> unit
596 val set_sslverifyhost : t -> curlSSLVerifyHost -> unit
597 val set_cookiejar : t -> string -> unit
598 val set_sslcipherlist : t -> string -> unit
599 val set_httpversion : t -> curlHTTPVersion -> unit
600 val set_ftpuseepsv : t -> bool -> unit
601 val set_dnscachetimeout : t -> int -> unit
602 val set_dnsuseglobalcache : t -> bool -> unit
603 val set_debugfunction : t -> (t -> curlDebugType -> string -> unit) -> unit
604 val set_private : t -> string -> unit
605 val set_http200aliases : t -> string list -> unit
606 val set_unrestrictedauth : t -> bool -> unit
607 val set_ftpuseeprt : t -> bool -> unit
608 val set_httpauth : t -> curlAuth list -> unit
609 val set_ftpcreatemissingdirs : t -> bool -> unit
610 val set_proxyauth : t -> curlAuth list -> unit
611 val set_ftpresponsetimeout : t -> int -> unit
612 val set_ipresolve : t -> curlIPResolve -> unit
613 val set_maxfilesize : t -> int32 -> unit
614 val set_infilesizelarge : t -> int64 -> unit
615 val set_resumefromlarge : t -> int64 -> unit
616 val set_maxfilesizelarge : t -> int64 -> unit
617 val set_netrcfile : t -> string -> unit
618 val set_ftpssl : t -> curlFTPSSL -> unit
619 val set_postfieldsizelarge : t -> int64 -> unit
620 val set_tcpnodelay : t -> bool -> unit
621 val set_ftpsslauth : t -> curlFTPSSLAuth -> unit
622 val set_ioctlfunction : t -> (t -> curlIOCmd -> curlIOErr) -> unit
623 val set_ftpaccount : t -> string -> unit
624 val set_cookielist : t -> string -> unit
625 val set_ignorecontentlength : t -> bool -> unit
626 val set_ftpskippasvip : t -> bool -> unit
627 val set_ftpfilemethod : t -> curlFTPMethod -> unit
628 val set_localport : t -> int -> unit
629 val set_localportrange : t -> int -> unit
630 val set_connectonly : t -> bool -> unit
631 val set_maxsendspeedlarge : t -> int64 -> unit
632 val set_maxrecvspeedlarge : t -> int64 -> unit
633 val set_ftpalternativetouser : t -> string -> unit
634 val set_sslsessionidcache : t -> bool -> unit
635 val set_sshauthtypes : t -> curlSSHAuthTypes list -> unit
636 val set_sshpublickeyfile : t -> string -> unit
637 val set_sshprivatekeyfile : t -> string -> unit
638 val set_ftpsslccc : t -> curlFTPSSLCCC -> unit
639 val set_timeoutms : t -> int -> unit
640 val set_connecttimeoutms : t -> int -> unit
641 val set_httptransferdecoding : t -> bool -> unit
642 val set_httpcontentdecoding : t -> bool -> unit
643 val set_newfileperms : t -> int -> unit
644 val set_newdirectoryperms : t -> int -> unit
645 val set_post301 : t -> bool -> unit
646 val set_sshhostpublickeymd5 : t -> string -> unit
647 val set_copypostfields : t -> string -> unit
648 val set_proxytransfermode : t -> bool -> unit
649 val set_seekfunction : t -> (int64 -> curlSeek -> curlSeekResult) -> unit
650 val set_autoreferer : t -> bool -> unit
651 val set_opensocketfunction : t -> (Unix.file_descr -> unit) -> unit
652 val set_proxytype : t -> curlProxyType -> unit
653 val set_protocols : t -> curlProto list -> unit
654 val set_redirprotocols : t -> curlProto list -> unit
656 (** [set_resolve t add del] adjusts builtin dns mapping
658 @param add is the (host,port,address) list to add to dns mapping
659 @param del is the (host,port) list to remove from mapping
661 val set_resolve : t -> (string * int * string) list -> (string * int) list -> unit
662 val set_dns_servers : t -> string list -> unit
663 val set_mailfrom : t -> string -> unit
664 val set_mailrcpt : t -> string list -> unit
665 val set_pipewait : t -> bool -> unit
667 (** {2 Get transfer properties} *)
669 val get_effectiveurl : t -> string
670 val get_redirecturl : t -> string
671 val get_httpcode : t -> int
672 val get_responsecode : t -> int
673 val get_totaltime : t -> float
674 val get_namelookuptime : t -> float
675 val get_connecttime : t -> float
676 val get_pretransfertime : t -> float
677 val get_sizeupload : t -> float
678 val get_sizedownload : t -> float
679 val get_speeddownload : t -> float
680 val get_speedupload : t -> float
681 val get_headersize : t -> int
682 val get_requestsize : t -> int
683 val get_sslverifyresult : t -> int
684 val get_filetime : t -> float
685 val get_contentlengthdownload : t -> float
686 val get_contentlengthupload : t -> float
687 val get_starttransfertime : t -> float
688 val get_contenttype : t -> string
689 val get_redirecttime : t -> float
690 val get_redirectcount : t -> int
691 val get_private : t -> string
692 val get_httpconnectcode : t -> int
693 val get_httpauthavail : t -> curlAuth list
694 val get_proxyauthavail : t -> curlAuth list
695 val get_oserrno : t -> int
696 val get_numconnects : t -> int
697 val get_sslengines : t -> string list
698 val get_cookielist : t -> string list
699 val get_lastsocket : t -> int
700 val get_ftpentrypath : t -> string
701 val get_primaryip : t -> string
702 val get_localip : t -> string
703 (** @since 0.5.5 (libcurl 7.21.0) *)
704 val get_localport : t -> int
705 (** @since 0.5.5 (libcurl 7.21.0) *)
706 val get_conditionunmet : t -> bool
707 (** @since 0.6.1 (libcurl 7.19.4) *)
708 val get_certinfo : t -> string list list
710 (** {2 Object interface} *)
712 class handle :
713 object ('a)
714 val conn : t
715 method handle : t
716 method cleanup : unit
717 method duphandle : 'a
718 method perform : unit
720 method set_writefunction : (string -> int) -> unit
721 method set_readfunction : (int -> string) -> unit
722 method set_infilesize : int -> unit
723 method set_url : string -> unit
724 method set_proxy : string -> unit
725 method set_proxyport : int -> unit
726 method set_httpproxytunnel : bool -> unit
727 method set_verbose : bool -> unit
728 method set_header : bool -> unit
729 method set_noprogress : bool -> unit
730 method set_nosignal : bool -> unit
731 method set_nobody : bool -> unit
732 method set_failonerror : bool -> unit
733 method set_upload : bool -> unit
734 method set_post : bool -> unit
735 method set_ftplistonly : bool -> unit
736 method set_ftpappend : bool -> unit
737 method set_netrc : curlNETRCOption -> unit
738 method set_encoding : curlEncoding -> unit
739 method set_followlocation : bool -> unit
740 method set_transfertext : bool -> unit
741 method set_put : bool -> unit
742 method set_userpwd : string -> unit
743 method set_proxyuserpwd : string -> unit
744 method set_range : string -> unit
745 method set_errorbuffer : string ref -> unit
746 method set_timeout : int -> unit
747 method set_postfields : string -> unit
748 method set_postfieldsize : int -> unit
749 method set_referer : string -> unit
750 method set_useragent : string -> unit
751 method set_ftpport : string -> unit
752 method set_lowspeedlimit : int -> unit
753 method set_lowspeedtime : int -> unit
754 method set_resumefrom : int -> unit
755 method set_cookie : string -> unit
756 method set_httpheader : string list -> unit
757 method set_httppost : curlHTTPPost list -> unit
758 method set_sslcert : string -> unit
759 method set_sslcerttype : string -> unit
760 method set_sslcertpasswd : string -> unit
761 method set_sslkey : string -> unit
762 method set_sslkeytype : string -> unit
763 method set_sslkeypasswd : string -> unit
764 method set_sslengine : string -> unit
765 method set_sslenginedefault : bool -> unit
766 method set_certinfo : bool -> unit
767 method set_crlf : bool -> unit
768 method set_quote : string list -> unit
769 method set_postquote : string list -> unit
770 method set_headerfunction: (string -> int) -> unit
771 method set_cookiefile : string -> unit
772 method set_sslversion : curlSSLVersion -> unit
773 method set_timecondition : curlTimeCondition -> unit
774 method set_timevalue : int32 -> unit
775 method set_customrequest : string -> unit
776 method set_interface : string -> unit
777 method set_krb4level : curlKRB4Level -> unit
778 method set_progressfunction :
779 (float -> float -> float -> float -> bool) -> unit
780 method set_sslverifypeer : bool -> unit
781 method set_cainfo : string -> unit
782 method set_capath : string -> unit
783 method set_filetime : bool -> unit
784 method set_maxredirs : int -> unit
785 method set_maxconnects : int -> unit
786 method set_closepolicy : curlClosePolicy -> unit
787 method set_freshconnect : bool -> unit
788 method set_forbidreuse : bool -> unit
789 method set_randomfile : string -> unit
790 method set_egdsocket : string -> unit
791 method set_connecttimeout : int -> unit
792 method set_httpget : bool -> unit
793 method set_sslverifyhost : curlSSLVerifyHost -> unit
794 method set_cookiejar : string -> unit
795 method set_sslcipherlist : string -> unit
796 method set_httpversion : curlHTTPVersion -> unit
797 method set_ftpuseepsv : bool -> unit
798 method set_dnscachetimeout : int -> unit
799 method set_dnsuseglobalcache : bool -> unit
800 method set_debugfunction : (t -> curlDebugType -> string -> unit) -> unit
801 method set_private : string -> unit
802 method set_http200aliases : string list -> unit
803 method set_unrestrictedauth : bool -> unit
804 method set_ftpuseeprt : bool -> unit
805 method set_httpauth : curlAuth list -> unit
806 method set_ftpcreatemissingdirs : bool -> unit
807 method set_proxyauth : curlAuth list -> unit
808 method set_ftpresponsetimeout : int -> unit
809 method set_ipresolve : curlIPResolve -> unit
810 method set_maxfilesize : int32 -> unit
811 method set_infilesizelarge : int64 -> unit
812 method set_resumefromlarge : int64 -> unit
813 method set_maxfilesizelarge : int64 -> unit
814 method set_netrcfile : string -> unit
815 method set_ftpssl : curlFTPSSL -> unit
816 method set_postfieldsizelarge : int64 -> unit
817 method set_tcpnodelay : bool -> unit
818 method set_ftpsslauth : curlFTPSSLAuth -> unit
819 method set_ioctlfunction : (t -> curlIOCmd -> curlIOErr) -> unit
820 method set_ftpaccount : string -> unit
821 method set_cookielist : string -> unit
822 method set_ignorecontentlength : bool -> unit
823 method set_ftpskippasvip : bool -> unit
824 method set_ftpfilemethod : curlFTPMethod -> unit
825 method set_localport : int -> unit
826 method set_localportrange : int -> unit
827 method set_connectonly : bool -> unit
828 method set_maxsendspeedlarge : int64 -> unit
829 method set_maxrecvspeedlarge : int64 -> unit
830 method set_ftpalternativetouser : string -> unit
831 method set_sslsessionidcache : bool -> unit
832 method set_sshauthtypes : curlSSHAuthTypes list -> unit
833 method set_sshpublickeyfile : string -> unit
834 method set_sshprivatekeyfile : string -> unit
835 method set_ftpsslccc : curlFTPSSLCCC -> unit
836 method set_timeoutms : int -> unit
837 method set_connecttimeoutms : int -> unit
838 method set_httptransferdecoding : bool -> unit
839 method set_httpcontentdecoding : bool -> unit
840 method set_newfileperms : int -> unit
841 method set_newdirectoryperms : int -> unit
842 method set_post301 : bool -> unit
843 method set_sshhostpublickeymd5 : string -> unit
844 method set_copypostfields : string -> unit
845 method set_proxytransfermode : bool -> unit
846 method set_seekfunction : (int64 -> curlSeek -> curlSeekResult) -> unit
847 method set_autoreferer : bool -> unit
848 method set_opensocketfunction : (Unix.file_descr -> unit) -> unit
849 method set_proxytype : curlProxyType -> unit
850 method set_resolve : (string * int * string) list -> (string * int) list -> unit
851 method set_dns_servers : string list -> unit
853 method get_effectiveurl : string
854 method get_redirecturl : string
855 method get_httpcode : int
856 method get_responsecode : int
857 method get_totaltime : float
858 method get_namelookuptime : float
859 method get_connecttime : float
860 method get_pretransfertime : float
861 method get_sizeupload : float
862 method get_sizedownload : float
863 method get_speeddownload : float
864 method get_speedupload : float
865 method get_headersize : int
866 method get_requestsize : int
867 method get_sslverifyresult : int
868 method get_filetime : float
869 method get_contentlengthdownload : float
870 method get_contentlengthupload : float
871 method get_starttransfertime : float
872 method get_contenttype : string
873 method get_redirecttime : float
874 method get_redirectcount : int
875 method get_private : string
876 method get_httpconnectcode : int
877 method get_httpauthavail : curlAuth list
878 method get_proxyauthavail : curlAuth list
879 method get_oserrno : int
880 method get_numconnects : int
881 method get_sslengines : string list
882 method get_cookielist : string list
883 method get_lastsocket : int
884 method get_ftpentrypath : string
885 method get_primaryip : string
886 method get_localip : string
887 method get_localport : int
888 method get_conditionunmet : bool
889 method get_certinfo : string list list
892 (** {2 curl_multi API} *)
894 (** Curl multi stack. Functions may raise [Failure] on critical errors *)
895 module Multi : sig
897 (** type of Curl multi stack *)
898 type mt
900 type curlPipelining = PIPE_NOTHING | PIPE_HTTP1 | PIPE_MULTIPLEX
902 type curlMultiOption =
903 | CURLMOPT_PIPELINING of curlPipelining list
904 | CURLMOPT_MAXCONNECTS of int
905 | CURLMOPT_MAX_PIPELINE_LENGTH of int
906 | CURLMOPT_MAX_HOST_CONNECTIONS of int
908 (** exception raised on internal errors *)
909 exception Error of string
911 (** create new multi stack *)
912 val create : unit -> mt
914 (** add handle to multi stack *)
915 val add : mt -> t -> unit
917 (** remove handle from multi stack (effectively halting the transfer) *)
918 val remove : mt -> t -> unit
920 (** perform pending data transfers (if any) on all handles currently in multi stack
921 @return the number of handles that still transfer data *)
922 val perform : mt -> int
924 (** wait till there are some active data transfers on multi stack
925 @return whether [perform] should be called *)
926 val wait : mt -> bool
928 (** remove finished handle from the multi stack if any. The returned handle may be reused *)
929 val remove_finished : mt -> (t * curlCode) option
931 (** destroy multi handle (all transfers are stopped, but individual {!type: Curl.t} handles can be reused) *)
932 val cleanup : mt -> unit
934 (** events that should be reported for the socket *)
935 type poll =
936 | POLL_NONE (** none *)
937 | POLL_IN (** available for reading *)
938 | POLL_OUT (** available for writing *)
939 | POLL_INOUT (** both *)
940 | POLL_REMOVE (** socket not needed anymore *)
942 (** socket status *)
943 type fd_status =
944 | EV_AUTO (** determine socket status automatically (with extra system call) *)
945 | EV_IN (** socket has incoming data *)
946 | EV_OUT (** socket is available for writing *)
947 | EV_INOUT (** both *)
949 (** set the function to receive notifications on what socket events
950 are currently interesting for libcurl on the specified socket handle *)
951 val set_socket_function : mt -> (Unix.file_descr -> poll -> unit) -> unit
953 (** set the function to receive notification when libcurl internal timeout changes,
954 timeout value is in milliseconds
956 NB {!action_timeout} should be called when timeout occurs *)
957 val set_timer_function : mt -> (int -> unit) -> unit
959 (** perform pending data transfers (if any) on all handles currently in multi stack
960 (not recommended, {!action} should be used instead)
961 @return the number of handles that still transfer data
962 @raise Error on errors
964 val action_all : mt -> int
966 (** inform libcurl that timeout occured
967 @raise Error on errors
969 val action_timeout : mt -> unit
971 (** [action mt fd status] informs libcurl about event on the specified socket.
972 [status] specifies socket status. Perform pending data transfers.
973 @return the number of handles still active
974 @raise Error on errors
976 val action : mt -> Unix.file_descr -> fd_status -> int
978 (** [timeout mt] polls multi handle for timeout (not recommended, use {!set_timer_function} instead).
979 @return maximum allowed number of milliseconds to wait before calling libcurl to perform actions
980 @raise Error on errors
982 external timeout : mt -> int = "caml_curl_multi_timeout"
984 (** @raise NotImplemented for not implemented option *)
985 val setopt : mt -> curlMultiOption -> unit