minor style changes
[ocurl.git] / curl.mli
blobb2dc2b409df6cd14002197edf929e32bd0a9f3fe
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 libcurl 7.34.0, will request TLSv1.x in previous versions *)
144 | SSLVERSION_TLSv1_1 (** Added in libcurl 7.34.0, will request TLSv1.x in previous versions *)
145 | SSLVERSION_TLSv1_2 (** Added in libcurl 7.34.0, will request TLSv1.x in previous versions *)
146 | SSLVERSION_TLSv1_3 (** Added in libcurl 7.52.0, will request TLSv1.x in previous versions *)
148 type curlTimeCondition =
149 | TIMECOND_NONE (** since 0.6.1 *)
150 | TIMECOND_IFMODSINCE
151 | TIMECOND_IFUNMODSINCE
152 | TIMECOND_LASTMOD (** since 0.6.1 *)
154 type curlKRB4Level =
155 | KRB4_NONE
156 | KRB4_CLEAR
157 | KRB4_SAFE
158 | KRB4_CONFIDENTIAL
159 | KRB4_PRIVATE
161 type curlClosePolicy =
162 | CLOSEPOLICY_OLDEST
163 | CLOSEPOLICY_LEAST_RECENTLY_USED
165 type curlSSLVerifyHost =
166 | SSLVERIFYHOST_NONE (** connection succeeds regardless of the names in the certificate *)
167 | SSLVERIFYHOST_EXISTENCE (** deprecated, equivalent to SSLVERIFYHOST_HOSTNAME *)
168 | SSLVERIFYHOST_HOSTNAME (** certificate must indicate the matching hostname, or the connection fails *)
170 type curlHTTPVersion =
171 | HTTP_VERSION_NONE (** libcurl will make the best choice *)
172 | HTTP_VERSION_1_0 (** please use HTTP 1.0 *)
173 | HTTP_VERSION_1_1 (** please use HTTP 1.1 *)
174 | HTTP_VERSION_2 (** please use HTTP 2 (requires libcurl >= 7.33.0, otherwise will fallback to libcurl choice) *)
175 | HTTP_VERSION_2TLS (** use version 2 for HTTPS, version 1.1 for HTTP (requires libcurl >= 7.47.0) *)
176 | HTTP_VERSION_2_PRIOR_KNOWLEDGE (** Issue non-TLS HTTP requests using HTTP/2 without HTTP/1 (requires libcurl >= 7.49.0) *)
177 | HTTP_VERSION_3 (** Makes use of explicit HTTP/3 without fallback. Use CURLOPT_ALTSVC to enable HTTP/3 upgrade (requires libcurl >= 7.66.0) *)
179 type curlDebugType =
180 | DEBUGTYPE_TEXT
181 | DEBUGTYPE_HEADER_IN
182 | DEBUGTYPE_HEADER_OUT
183 | DEBUGTYPE_DATA_IN
184 | DEBUGTYPE_DATA_OUT
185 | DEBUGTYPE_SSL_DATA_IN
186 | DEBUGTYPE_SSL_DATA_OUT
187 | DEBUGTYPE_END
189 type curlAuth =
190 | CURLAUTH_BASIC
191 | CURLAUTH_DIGEST
192 | CURLAUTH_GSSNEGOTIATE
193 | CURLAUTH_NTLM
194 | CURLAUTH_ANY
195 | CURLAUTH_ANYSAFE
197 type curlIPResolve =
198 | IPRESOLVE_WHATEVER
199 | IPRESOLVE_V4
200 | IPRESOLVE_V6
202 type curlFTPSSL =
203 | FTPSSL_NONE
204 | FTPSSL_TRY
205 | FTPSSL_CONTROL
206 | FTPSSL_ALL
208 type curlFTPSSLAuth =
209 | FTPAUTH_DEFAULT
210 | FTPAUTH_SSL
211 | FTPAUTH_TLS
213 type curlIOCmd =
214 | IOCMD_NOP
215 | IOCMD_RESTARTREAD
217 type curlIOErr =
218 | IOE_OK
219 | IOE_UNKNOWNCMD
220 | IOE_FAILRESTART
222 type curlSeekResult =
223 | SEEKFUNC_OK
224 | SEEKFUNC_FAIL
225 | SEEKFUNC_CANTSEEK
227 type curlFTPMethod =
228 | FTPMETHOD_DEFAULT
229 | FTPMETHOD_MULTICWD
230 | FTPMETHOD_NOCWD
231 | FTPMETHOD_SINGLECWD
233 type curlSSHAuthTypes =
234 | SSHAUTH_ANY
235 | SSHAUTH_PUBLICKEY
236 | SSHAUTH_PASSWORD
237 | SSHAUTH_HOST
238 | SSHAUTH_KEYBOARD
240 type curlFTPSSLCCC =
241 | FTPSSL_CCC_NONE
242 | FTPSSL_CCC_PASSIVE
243 | FTPSSL_CCC_ACTIVE
245 type curlSeek =
246 | SEEK_SET
247 | SEEK_CUR
248 | SEEK_END
250 type curlProxyType =
251 | CURLPROXY_HTTP
252 | CURLPROXY_HTTP_1_0 (** since libcurl 7.19.4 *)
253 | CURLPROXY_SOCKS4 (** since libcurl 7.15.2 *)
254 | CURLPROXY_SOCKS5
255 | CURLPROXY_SOCKS4A (** since libcurl 7.18.0 *)
256 | CURLPROXY_SOCKS5_HOSTNAME (** since libcurl 7.18.0 *)
258 type data_source =
259 | String of string (** Equivalent to `CURLMIME_DATA` *)
260 | File of string (** Equivalent to `CURLMIME_FILEDATA` *)
262 type curlMIMEPartData =
263 | CURLMIME_DATA of string
264 | CURLMIME_FILEDATA of string
265 | CURLMIME_DATA_WITH_NAME of {
266 data: data_source;
267 name: string option;
268 filename: string option;
271 type curlMIMEEncoding =
272 | CURLMIME_8BIT
273 | CURLMIME_BINARY
274 | CURLMIME_7BIT
275 | CURLMIME_QUOTEDPRINTABLE
276 | CURLMIME_BASE64
277 | CURLMIME_NONE
279 type curlMIMEPart =
281 encoding: curlMIMEEncoding;
282 headers: string list;
283 subparts: curlMIMEPart list;
284 data: curlMIMEPartData;
287 type curlKHMatch =
288 | CURLKHMATCH_OK
289 | CURLKHMATCH_MISMATCH of string
290 (** Argument consists of the base64-encoded public key of the remote host as
291 as found in the "known hosts" file **)
292 | CURLKHMATCH_MISSING
294 type curlKHStat =
295 | CURLKHSTAT_FINE_ADD_TO_FILE
296 | CURLKHSTAT_FINE
297 | CURLKHSTAT_REJECT
298 | CURLKHSTAT_DEFER
300 (** Protocols to enable (via CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS) *)
301 type curlProto =
302 | CURLPROTO_ALL (** enable everything *)
303 | CURLPROTO_HTTP
304 | CURLPROTO_HTTPS
305 | CURLPROTO_FTP
306 | CURLPROTO_FTPS
307 | CURLPROTO_SCP
308 | CURLPROTO_SFTP
309 | CURLPROTO_TELNET
310 | CURLPROTO_LDAP
311 | CURLPROTO_LDAPS
312 | CURLPROTO_DICT
313 | CURLPROTO_FILE
314 | CURLPROTO_TFTP
315 | CURLPROTO_IMAP
316 | CURLPROTO_IMAPS
317 | CURLPROTO_POP3
318 | CURLPROTO_POP3S
319 | CURLPROTO_SMTP
320 | CURLPROTO_SMTPS
321 | CURLPROTO_RTSP
322 | CURLPROTO_RTMP
323 | CURLPROTO_RTMPT
324 | CURLPROTO_RTMPE
325 | CURLPROTO_RTMPTE
326 | CURLPROTO_RTMPS
327 | CURLPROTO_RTMPTS
328 | CURLPROTO_GOPHER
330 (** if flag is not supported by libcurl - enabling it does nothing *)
331 type curlPostRedir =
332 | REDIR_POST_ALL
333 | REDIR_POST_301
334 | REDIR_POST_302
335 | REDIR_POST_303 (** added in libcurl 7.26.0 *)
337 type curlSslOption =
338 | CURLSSLOPT_ALLOW_BEAST
339 | CURLSSLOPT_NO_REVOKE
340 | CURLSSLOPT_NO_PARTIALCHAIN
341 | CURLSSLOPT_REVOKE_BEST_EFFORT
342 | CURLSSLOPT_NATIVE_CA
343 | CURLSSLOPT_AUTO_CLIENT_CERT
345 type 'a xfer_result = Proceed of 'a | Pause | Abort
347 type write_result = unit xfer_result
348 type read_result = string xfer_result
350 val proceed : write_result
352 type curlOption =
353 | CURLOPT_WRITEFUNCTION of (string -> int)
354 | CURLOPT_READFUNCTION of (int -> string)
355 | CURLOPT_INFILESIZE of int
356 | CURLOPT_URL of string
357 | CURLOPT_PROXY of string
358 | CURLOPT_PROXYPORT of int
359 | CURLOPT_HTTPPROXYTUNNEL of bool
360 | CURLOPT_VERBOSE of bool
361 | CURLOPT_HEADER of bool
362 | CURLOPT_NOPROGRESS of bool
363 | CURLOPT_NOSIGNAL of bool
364 | CURLOPT_NOBODY of bool
365 | CURLOPT_FAILONERROR of bool
366 | CURLOPT_UPLOAD of bool
367 | CURLOPT_POST of bool
368 | CURLOPT_FTPLISTONLY of bool
369 | CURLOPT_FTPAPPEND of bool
370 | CURLOPT_NETRC of curlNETRCOption
371 | CURLOPT_ENCODING of curlEncoding
372 | CURLOPT_FOLLOWLOCATION of bool
373 | CURLOPT_TRANSFERTEXT of bool
374 | CURLOPT_PUT of bool
375 | CURLOPT_USERPWD of string
376 | CURLOPT_PROXYUSERPWD of string
377 | CURLOPT_RANGE of string
378 | CURLOPT_ERRORBUFFER of string ref
379 | CURLOPT_TIMEOUT of int
380 | CURLOPT_POSTFIELDS of string
381 | CURLOPT_POSTFIELDSIZE of int
382 | CURLOPT_REFERER of string
383 | CURLOPT_USERAGENT of string
384 | CURLOPT_FTPPORT of string
385 | CURLOPT_LOWSPEEDLIMIT of int
386 | CURLOPT_LOWSPEEDTIME of int
387 | CURLOPT_RESUMEFROM of int
388 | CURLOPT_COOKIE of string
389 | CURLOPT_HTTPHEADER of string list
390 | CURLOPT_HTTPPOST of curlHTTPPost list
391 | CURLOPT_SSLCERT of string
392 | CURLOPT_SSLCERTTYPE of string
393 | CURLOPT_SSLCERTPASSWD of string
394 | CURLOPT_SSLKEY of string
395 | CURLOPT_SSLKEYTYPE of string
396 | CURLOPT_SSLKEYPASSWD of string
397 | CURLOPT_SSLENGINE of string
398 | CURLOPT_SSLENGINEDEFAULT of bool
399 | CURLOPT_CRLF of bool
400 | CURLOPT_QUOTE of string list
401 | CURLOPT_POSTQUOTE of string list
402 | CURLOPT_HEADERFUNCTION of (string -> int)
403 | CURLOPT_COOKIEFILE of string
404 | CURLOPT_SSLVERSION of curlSSLVersion
405 | CURLOPT_TIMECONDITION of curlTimeCondition
406 | CURLOPT_TIMEVALUE of int32
407 | CURLOPT_CUSTOMREQUEST of string
408 | CURLOPT_INTERFACE of string
409 | CURLOPT_KRB4LEVEL of curlKRB4Level
410 | CURLOPT_PROGRESSFUNCTION of (float -> float -> float -> float -> bool)
411 | CURLOPT_SSLVERIFYPEER of bool
412 | CURLOPT_CAINFO of string
413 | CURLOPT_CAPATH of string
414 | CURLOPT_FILETIME of bool
415 | CURLOPT_MAXREDIRS of int
416 | CURLOPT_MAXCONNECTS of int
417 | CURLOPT_CLOSEPOLICY of curlClosePolicy
418 | CURLOPT_FRESHCONNECT of bool
419 | CURLOPT_FORBIDREUSE of bool
420 | CURLOPT_RANDOMFILE of string
421 | CURLOPT_EGDSOCKET of string
422 | CURLOPT_CONNECTTIMEOUT of int
423 | CURLOPT_HTTPGET of bool
424 | CURLOPT_SSLVERIFYHOST of curlSSLVerifyHost
425 | CURLOPT_COOKIEJAR of string
426 | CURLOPT_SSLCIPHERLIST of string
427 | CURLOPT_HTTPVERSION of curlHTTPVersion
428 | CURLOPT_FTPUSEEPSV of bool
429 | CURLOPT_DNSCACHETIMEOUT of int
430 | CURLOPT_DNSUSEGLOBALCACHE of bool
431 | CURLOPT_DEBUGFUNCTION of (t -> curlDebugType -> string -> unit)
432 | CURLOPT_PRIVATE of string (** doesn't employ libcurl's CURLOPT_PRIVATE *)
433 | CURLOPT_HTTP200ALIASES of string list
434 | CURLOPT_UNRESTRICTEDAUTH of bool
435 | CURLOPT_FTPUSEEPRT of bool
436 | CURLOPT_HTTPAUTH of curlAuth list
437 | CURLOPT_FTPCREATEMISSINGDIRS of bool
438 | CURLOPT_PROXYAUTH of curlAuth list
439 | CURLOPT_FTPRESPONSETIMEOUT of int
440 | CURLOPT_IPRESOLVE of curlIPResolve
441 | CURLOPT_MAXFILESIZE of int32
442 | CURLOPT_INFILESIZELARGE of int64
443 | CURLOPT_RESUMEFROMLARGE of int64
444 | CURLOPT_MAXFILESIZELARGE of int64
445 | CURLOPT_NETRCFILE of string
446 | CURLOPT_FTPSSL of curlFTPSSL
447 | CURLOPT_POSTFIELDSIZELARGE of int64
448 | CURLOPT_TCPNODELAY of bool
449 | CURLOPT_TCP_FASTOPEN of bool
450 | CURLOPT_FTPSSLAUTH of curlFTPSSLAuth
451 | CURLOPT_IOCTLFUNCTION of (t -> curlIOCmd -> curlIOErr)
452 | CURLOPT_FTPACCOUNT of string
453 | CURLOPT_COOKIELIST of string
454 | CURLOPT_IGNORECONTENTLENGTH of bool
455 | CURLOPT_FTPSKIPPASVIP of bool
456 | CURLOPT_FTPFILEMETHOD of curlFTPMethod
457 | CURLOPT_LOCALPORT of int
458 | CURLOPT_LOCALPORTRANGE of int
459 | CURLOPT_CONNECTONLY of bool
460 | CURLOPT_MAXSENDSPEEDLARGE of int64
461 | CURLOPT_MAXRECVSPEEDLARGE of int64
462 | CURLOPT_FTPALTERNATIVETOUSER of string
463 | CURLOPT_SSLSESSIONIDCACHE of bool
464 | CURLOPT_SSHAUTHTYPES of curlSSHAuthTypes list
465 | CURLOPT_SSHPUBLICKEYFILE of string
466 | CURLOPT_SSHPRIVATEKEYFILE of string
467 | CURLOPT_FTPSSLCCC of curlFTPSSLCCC
468 | CURLOPT_TIMEOUTMS of int
469 | CURLOPT_CONNECTTIMEOUTMS of int
470 | CURLOPT_HTTPTRANSFERDECODING of bool
471 | CURLOPT_HTTPCONTENTDECODING of bool
472 | CURLOPT_NEWFILEPERMS of int
473 | CURLOPT_NEWDIRECTORYPERMS of int
474 | CURLOPT_POST301 of bool
475 | CURLOPT_SSHHOSTPUBLICKEYMD5 of string
476 | CURLOPT_COPYPOSTFIELDS of string
477 | CURLOPT_PROXYTRANSFERMODE of bool
478 | CURLOPT_SEEKFUNCTION of (int64 -> curlSeek -> curlSeekResult)
479 | CURLOPT_AUTOREFERER of bool
480 | CURLOPT_OPENSOCKETFUNCTION of (Unix.file_descr -> unit)
481 (* | CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit) *)
482 | CURLOPT_PROXYTYPE of curlProxyType
483 | CURLOPT_PROTOCOLS of curlProto list
484 | CURLOPT_REDIR_PROTOCOLS of curlProto list
485 | CURLOPT_RESOLVE of string list
486 | CURLOPT_DNS_SERVERS of string
487 | CURLOPT_MAIL_FROM of string
488 | CURLOPT_MAIL_RCPT of string list
489 | CURLOPT_PIPEWAIT of bool
490 | CURLOPT_CERTINFO of bool
491 | CURLOPT_USERNAME of string
492 | CURLOPT_PASSWORD of string
493 | CURLOPT_LOGIN_OPTIONS of string
494 | CURLOPT_CONNECT_TO of string list
495 | CURLOPT_POSTREDIR of curlPostRedir list
496 | CURLOPT_MIMEPOST of curlMIMEPart list (* @since libcurl 7.56.0 *)
497 | CURLOPT_SSHKNOWNHOSTS of string
498 | CURLOPT_SSHKEYFUNCTION of (curlKHMatch -> string -> curlKHStat)
499 (** The second argument to the passed function consists of the raw bytes of
500 the public key sent by the remote host. If the function raises an
501 exception the key will be rejected, and the connection will fail.**)
502 | CURLOPT_BUFFERSIZE of int
503 | CURLOPT_DOH_URL of string
504 | CURLOPT_SSL_OPTIONS of curlSslOption list
505 | CURLOPT_WRITEFUNCTION2 of (string -> write_result)
506 | CURLOPT_READFUNCTION2 of (int -> read_result)
507 | CURLOPT_XFERINFOFUNCTION of (int64 -> int64 -> int64 -> int64 -> bool)
508 | CURLOPT_PREREQFUNCTION of (string -> string -> int -> int -> bool)
509 | CURLOPT_AWS_SIGV4 of string
510 | CURLOPT_TCP_KEEPALIVE of bool
511 | CURLOPT_TCP_KEEPIDLE of int
512 | CURLOPT_TCP_KEEPINTVL of int
514 type initOption =
515 | CURLINIT_GLOBALALL
516 | CURLINIT_GLOBALSSL
517 | CURLINIT_GLOBALWIN32
518 | CURLINIT_GLOBALNOTHING
520 type curlInfo =
521 | CURLINFO_EFFECTIVE_URL
522 | CURLINFO_HTTP_CODE
523 | CURLINFO_RESPONSE_CODE
524 | CURLINFO_TOTAL_TIME
525 | CURLINFO_NAMELOOKUP_TIME
526 | CURLINFO_CONNECT_TIME
527 | CURLINFO_PRETRANSFER_TIME
528 | CURLINFO_SIZE_UPLOAD
529 | CURLINFO_SIZE_DOWNLOAD
530 | CURLINFO_SPEED_DOWNLOAD
531 | CURLINFO_SPEED_UPLOAD
532 | CURLINFO_HEADER_SIZE
533 | CURLINFO_REQUEST_SIZE
534 | CURLINFO_SSL_VERIFYRESULT
535 | CURLINFO_FILETIME
536 | CURLINFO_CONTENT_LENGTH_DOWNLOAD
537 | CURLINFO_CONTENT_LENGTH_UPLOAD
538 | CURLINFO_STARTTRANSFER_TIME
539 | CURLINFO_CONTENT_TYPE
540 | CURLINFO_REDIRECT_TIME
541 | CURLINFO_REDIRECT_COUNT
542 | CURLINFO_PRIVATE (** returns value previously set with CURLOPT_PRIVATE, doesn't employ libcurl's CURLINFO_PRIVATE *)
543 | CURLINFO_HTTP_CONNECTCODE
544 | CURLINFO_HTTPAUTH_AVAIL
545 | CURLINFO_PROXYAUTH_AVAIL
546 | CURLINFO_OS_ERRNO
547 | CURLINFO_NUM_CONNECTS
548 | CURLINFO_SSL_ENGINES
549 | CURLINFO_COOKIELIST
550 | CURLINFO_LASTSOCKET
551 | CURLINFO_FTP_ENTRY_PATH
552 | CURLINFO_REDIRECT_URL
553 | CURLINFO_PRIMARY_IP
554 | CURLINFO_LOCAL_IP
555 | CURLINFO_LOCAL_PORT
556 | CURLINFO_CONDITION_UNMET
557 | CURLINFO_CERTINFO
558 | CURLINFO_ACTIVESOCKET
559 | CURLINFO_HTTP_VERSION
561 type curlInfoResult =
562 | CURLINFO_String of string
563 | CURLINFO_Long of int
564 | CURLINFO_Double of float
565 | CURLINFO_StringList of string list
566 | CURLINFO_StringListList of string list list
567 | CURLINFO_Socket of Unix.file_descr
568 | CURLINFO_Version of curlHTTPVersion
570 type curlSslBackend =
571 | CURLSSLBACKEND_NONE
572 | CURLSSLBACKEND_OPENSSL
573 | CURLSSLBACKEND_GNUTLS
574 | CURLSSLBACKEND_NSS
575 | CURLSSLBACKEND_GSKIT
576 | CURLSSLBACKEND_WOLFSSL
577 | CURLSSLBACKEND_SCHANNEL
578 | CURLSSLBACKEND_SECURETRANSPORT
579 | CURLSSLBACKEND_MBEDTLS
580 | CURLSSLBACKEND_MESALINK
581 | CURLSSLBACKEND_BEARSSL
583 type curlSslSet =
584 | CURLSSLSET_OK
585 | CURLSSLSET_UNKNOWN_BACKEND
586 | CURLSSLSET_TOO_LATE
587 | CURLSSLSET_NO_BACKENDS
589 type version_info = {
590 version : string;
591 number : int * int * int;
592 host : string;
593 features : string list;
594 ssl_version : string option;
595 libz_version : string option;
596 protocols : string list;
597 ares : string; (** starting from this field are optional features - may be empty/zero *)
598 ares_num : int;
599 libidn : string;
600 iconv_ver_num : int;
601 libssh_version : string;
604 type pauseOption = PAUSE_SEND | PAUSE_RECV | PAUSE_ALL
606 (** {2 MultiSSL mode } *)
608 exception CurlSslSetException of curlSslSet
610 val global_sslset : curlSslBackend -> unit
611 (** @since libcurl 7.56.0 *)
613 val global_sslset_str : string -> unit
614 (** @since libcurl 7.56.0 *)
616 val global_sslsetavail : unit -> curlSslBackend list
617 (** @since libcurl 7.56.0 *)
619 val global_sslsetavail_str : unit -> string list
620 (** @since libcurl 7.56.0 *)
622 (** {2 curl_easy API} *)
624 val global_init : initOption -> unit
625 val global_cleanup : unit -> unit
626 val init : unit -> t
627 val reset : t -> unit
628 (** Reset [t] to the default state *)
630 val setopt : t -> curlOption -> unit
631 (** @raise NotImplemented for not implemented option *)
633 val perform : t -> unit
634 val cleanup : t -> unit
635 val getinfo : t -> curlInfo -> curlInfoResult
636 val escape : string -> string
637 val unescape : string -> string
638 val getdate : string -> float -> float
639 val version : unit -> string
640 val strerror : curlCode -> string
641 val int_of_curlCode : curlCode -> int
642 val curlCode_of_int : int -> curlCode option
643 (** same as [int_of_curlCode] *)
645 val errno : curlCode -> int
646 val version_info : unit -> version_info
648 (** flags set the new state, ie to unpause - pass empty list *)
649 val pause : t -> pauseOption list -> unit
651 (** {2 Set transfer options}
653 All callback functions shouldn't raise exceptions.
654 Any exception raised in callback function will be silently caught and discared,
655 and transfer will be aborted. *)
657 val set_writefunction : t -> (string -> int) -> unit
659 (* Alternative API for the write callback that allows to pause download
660 NB to unpause - call [Curl.pause h \[\]] from progressfunction callback (which is called every second at least),
661 do not try to call unpause from another thread, see libcurl documentation for details *)
662 val set_writefunction2 : t -> (string -> write_result) -> unit
664 (** [readfunction n] should return string of length at most [n], otherwise
665 transfer will be aborted (as if with exception) *)
666 val set_readfunction : t -> (int -> string) -> unit
668 (* Alternative API for the read callback that allows to pause upload *)
669 val set_readfunction2 : t -> (int -> read_result) -> unit
671 val set_infilesize : t -> int -> unit
672 val set_url : t -> string -> unit
673 val set_proxy : t -> string -> unit
674 val set_proxyport : t -> int -> unit
675 val set_httpproxytunnel : t -> bool -> unit
676 val set_verbose : t -> bool -> unit
677 val set_header : t -> bool -> unit
678 val set_noprogress : t -> bool -> unit
679 val set_nosignal : t -> bool -> unit
680 val set_nobody : t -> bool -> unit
681 val set_failonerror : t -> bool -> unit
682 val set_upload : t -> bool -> unit
683 val set_post : t -> bool -> unit
684 val set_ftplistonly : t -> bool -> unit
685 val set_ftpappend : t -> bool -> unit
686 val set_netrc : t -> curlNETRCOption -> unit
687 val set_encoding : t -> curlEncoding -> unit
688 val set_followlocation : t -> bool -> unit
689 val set_transfertext : t -> bool -> unit
690 val set_put : t -> bool -> unit
691 val set_userpwd : t -> string -> unit
692 val set_proxyuserpwd : t -> string -> unit
693 val set_range : t -> string -> unit
694 val set_errorbuffer : t -> string ref -> unit
695 val set_timeout : t -> int -> unit
696 val set_postfields : t -> string -> unit
697 val set_postfieldsize : t -> int -> unit
698 val set_referer : t -> string -> unit
699 val set_useragent : t -> string -> unit
700 val set_ftpport : t -> string -> unit
701 val set_lowspeedlimit : t -> int -> unit
702 val set_lowspeedtime : t -> int -> unit
703 val set_resumefrom : t -> int -> unit
704 val set_cookie : t -> string -> unit
705 val set_httpheader : t -> string list -> unit
706 val set_httppost : t -> curlHTTPPost list -> unit
707 val set_sslcert : t -> string -> unit
708 val set_sslcerttype : t -> string -> unit
709 val set_sslcertpasswd : t -> string -> unit
710 val set_sslkey : t -> string -> unit
711 val set_sslkeytype : t -> string -> unit
712 val set_sslkeypasswd : t -> string -> unit
713 val set_sslengine : t -> string -> unit
714 val set_sslenginedefault : t -> bool -> unit
715 val set_certinfo : t -> bool -> unit
716 val set_crlf : t -> bool -> unit
717 val set_quote : t -> string list -> unit
718 val set_postquote : t -> string list -> unit
719 val set_headerfunction: t -> (string -> int) -> unit
720 val set_cookiefile : t -> string -> unit
721 val set_sslversion : t -> curlSSLVersion -> unit
722 val set_timecondition : t -> curlTimeCondition -> unit
723 val set_timevalue : t -> int32 -> unit
724 val set_customrequest : t -> string -> unit
725 val set_interface : t -> string -> unit
726 val set_krb4level : t -> curlKRB4Level -> unit
728 (** deprecated in favor of xferinfofunction since libcurl 7.32.0 *)
729 val set_progressfunction : t -> (float -> float -> float -> float -> bool) -> unit
731 (** callback returns whether transfer should be interrupted, ie return false to continue transfering *)
732 val set_xferinfofunction : t -> (int64 -> int64 -> int64 -> int64 -> bool) -> unit
734 (** callback returns whether transfer should be interrupted, ie return false to continue transfering *)
735 val set_prereqfunction : t -> (string -> string -> int -> int -> bool) -> unit
737 val set_sslverifypeer : t -> bool -> unit
738 val set_cainfo : t -> string -> unit
739 val set_capath : t -> string -> unit
740 val set_filetime : t -> bool -> unit
741 val set_maxredirs : t -> int -> unit
742 val set_maxconnects : t -> int -> unit
743 val set_closepolicy : t -> curlClosePolicy -> unit
744 val set_freshconnect : t -> bool -> unit
745 val set_forbidreuse : t -> bool -> unit
746 val set_randomfile : t -> string -> unit
747 val set_egdsocket : t -> string -> unit
748 val set_connecttimeout : t -> int -> unit
749 val set_httpget : t -> bool -> unit
750 val set_sslverifyhost : t -> curlSSLVerifyHost -> unit
751 val set_cookiejar : t -> string -> unit
752 val set_sslcipherlist : t -> string -> unit
753 val set_httpversion : t -> curlHTTPVersion -> unit
754 val set_ftpuseepsv : t -> bool -> unit
755 val set_dnscachetimeout : t -> int -> unit
756 val set_dnsuseglobalcache : t -> bool -> unit
757 val set_debugfunction : t -> (t -> curlDebugType -> string -> unit) -> unit
758 val set_private : t -> string -> unit
759 val set_http200aliases : t -> string list -> unit
760 val set_unrestrictedauth : t -> bool -> unit
761 val set_ftpuseeprt : t -> bool -> unit
762 val set_httpauth : t -> curlAuth list -> unit
763 val set_ftpcreatemissingdirs : t -> bool -> unit
764 val set_proxyauth : t -> curlAuth list -> unit
765 val set_ftpresponsetimeout : t -> int -> unit
766 val set_ipresolve : t -> curlIPResolve -> unit
767 val set_maxfilesize : t -> int32 -> unit
768 val set_infilesizelarge : t -> int64 -> unit
769 val set_resumefromlarge : t -> int64 -> unit
770 val set_maxfilesizelarge : t -> int64 -> unit
771 val set_netrcfile : t -> string -> unit
772 val set_ftpssl : t -> curlFTPSSL -> unit
773 val set_postfieldsizelarge : t -> int64 -> unit
774 val set_tcpnodelay : t -> bool -> unit
775 val set_tcpfastopen : t -> bool -> unit
776 val set_ftpsslauth : t -> curlFTPSSLAuth -> unit
777 val set_ioctlfunction : t -> (t -> curlIOCmd -> curlIOErr) -> unit
778 val set_ftpaccount : t -> string -> unit
779 val set_cookielist : t -> string -> unit
780 val set_ignorecontentlength : t -> bool -> unit
781 val set_ftpskippasvip : t -> bool -> unit
782 val set_ftpfilemethod : t -> curlFTPMethod -> unit
783 val set_localport : t -> int -> unit
784 val set_localportrange : t -> int -> unit
785 val set_connectonly : t -> bool -> unit
786 val set_maxsendspeedlarge : t -> int64 -> unit
787 val set_maxrecvspeedlarge : t -> int64 -> unit
788 val set_ftpalternativetouser : t -> string -> unit
789 val set_sslsessionidcache : t -> bool -> unit
790 val set_sshauthtypes : t -> curlSSHAuthTypes list -> unit
791 val set_sshpublickeyfile : t -> string -> unit
792 val set_sshprivatekeyfile : t -> string -> unit
793 val set_ftpsslccc : t -> curlFTPSSLCCC -> unit
794 val set_timeoutms : t -> int -> unit
795 val set_connecttimeoutms : t -> int -> unit
796 val set_httptransferdecoding : t -> bool -> unit
797 val set_httpcontentdecoding : t -> bool -> unit
798 val set_newfileperms : t -> int -> unit
799 val set_newdirectoryperms : t -> int -> unit
800 val set_post301 : t -> bool -> unit
801 val set_sshhostpublickeymd5 : t -> string -> unit
802 val set_copypostfields : t -> string -> unit
803 val set_proxytransfermode : t -> bool -> unit
804 val set_seekfunction : t -> (int64 -> curlSeek -> curlSeekResult) -> unit
805 val set_autoreferer : t -> bool -> unit
806 val set_opensocketfunction : t -> (Unix.file_descr -> unit) -> unit
807 val set_tcpkeepalive : t -> bool -> unit
808 val set_tcpkeepidle : t -> int -> unit
809 val set_tcpkeepintvl : t -> int -> unit
811 (** current implementation is faulty
812 ref https://github.com/ygrek/ocurl/issues/58
813 val set_closesocketfunction : t -> (Unix.file_descr -> unit) -> unit
815 val set_proxytype : t -> curlProxyType -> unit
816 val set_protocols : t -> curlProto list -> unit
817 val set_redirprotocols : t -> curlProto list -> unit
818 val set_buffersize : t -> int -> unit
819 val set_doh_url : t -> string -> unit
820 val set_ssl_options : t -> curlSslOption list -> unit
821 val set_aws_sigv4 : t -> string -> unit
823 (** [set_resolve t add del] adjusts builtin dns mapping
825 @param add is the (host,port,address) list to add to dns mapping
826 @param del is the (host,port) list to remove from mapping
828 val set_resolve : t -> (string * int * string) list -> (string * int) list -> unit
829 val set_dns_servers : t -> string list -> unit
830 val set_mailfrom : t -> string -> unit
831 val set_mailrcpt : t -> string list -> unit
832 val set_pipewait : t -> bool -> unit
833 val set_username : t -> string -> unit
834 (** @since 0.8.0 *)
836 val set_password : t -> string -> unit
837 (** @since 0.8.0 *)
839 val set_login_options : t -> string -> unit
840 (** @since 0.8.0 *)
842 val set_connect_to : t -> string list -> unit
843 (** @since 0.8.0 *)
845 val set_postredir : t -> curlPostRedir list -> unit
846 (** @since 0.8.1 *)
848 val set_mimepost : t -> curlMIMEPart list -> unit
849 (** @since 0.8.2 *)
851 val set_sshknownhosts : t -> string -> unit
852 val set_sshkeyfunction : t -> (curlKHMatch -> string -> curlKHStat) -> unit
854 (** {2 Get transfer properties} *)
856 val get_effectiveurl : t -> string
857 val get_redirecturl : t -> string
858 val get_httpcode : t -> int
859 val get_responsecode : t -> int
860 val get_totaltime : t -> float
861 val get_namelookuptime : t -> float
862 val get_connecttime : t -> float
863 val get_pretransfertime : t -> float
864 val get_sizeupload : t -> float
865 val get_sizedownload : t -> float
866 val get_speeddownload : t -> float
867 val get_speedupload : t -> float
868 val get_headersize : t -> int
869 val get_requestsize : t -> int
870 val get_sslverifyresult : t -> int
871 val get_filetime : t -> float
872 val get_contentlengthdownload : t -> float
873 val get_contentlengthupload : t -> float
874 val get_starttransfertime : t -> float
875 val get_contenttype : t -> string
876 val get_redirecttime : t -> float
877 val get_redirectcount : t -> int
878 val get_private : t -> string
879 val get_httpconnectcode : t -> int
880 val get_httpauthavail : t -> curlAuth list
881 val get_proxyauthavail : t -> curlAuth list
882 val get_oserrno : t -> int
883 val get_numconnects : t -> int
884 val get_sslengines : t -> string list
885 val get_cookielist : t -> string list
886 val get_lastsocket : t -> int
887 val get_activesocket : t -> Unix.file_descr option
888 val get_ftpentrypath : t -> string
889 val get_primaryip : t -> string
890 val get_localip : t -> string
891 (** @since 0.5.5 (libcurl 7.21.0) *)
893 val get_localport : t -> int
894 (** @since 0.5.5 (libcurl 7.21.0) *)
896 val get_conditionunmet : t -> bool
897 (** @since 0.6.1 (libcurl 7.19.4) *)
899 val get_certinfo : t -> string list list
901 val get_http_version : t -> curlHTTPVersion
902 (** @since 0.9.2 *)
904 (** {2 Object interface} *)
906 class handle :
907 object ('a)
908 val conn : t
909 method handle : t
910 method cleanup : unit
911 method perform : unit
913 method set_writefunction : (string -> int) -> unit
914 method set_writefunction2 : (string -> write_result) -> unit
915 method set_readfunction : (int -> string) -> unit
916 method set_readfunction2 : (int -> read_result) -> unit
917 method set_infilesize : int -> unit
918 method set_url : string -> unit
919 method set_proxy : string -> unit
920 method set_proxyport : int -> unit
921 method set_httpproxytunnel : bool -> unit
922 method set_verbose : bool -> unit
923 method set_header : bool -> unit
924 method set_noprogress : bool -> unit
925 method set_nosignal : bool -> unit
926 method set_nobody : bool -> unit
927 method set_failonerror : bool -> unit
928 method set_upload : bool -> unit
929 method set_post : bool -> unit
930 method set_ftplistonly : bool -> unit
931 method set_ftpappend : bool -> unit
932 method set_netrc : curlNETRCOption -> unit
933 method set_encoding : curlEncoding -> unit
934 method set_followlocation : bool -> unit
935 method set_transfertext : bool -> unit
936 method set_put : bool -> unit
937 method set_userpwd : string -> unit
938 method set_proxyuserpwd : string -> unit
939 method set_range : string -> unit
940 method set_errorbuffer : string ref -> unit
941 method set_timeout : int -> unit
942 method set_postfields : string -> unit
943 method set_postfieldsize : int -> unit
944 method set_referer : string -> unit
945 method set_useragent : string -> unit
946 method set_ftpport : string -> unit
947 method set_lowspeedlimit : int -> unit
948 method set_lowspeedtime : int -> unit
949 method set_resumefrom : int -> unit
950 method set_cookie : string -> unit
951 method set_httpheader : string list -> unit
952 method set_httppost : curlHTTPPost list -> unit
953 method set_sslcert : string -> unit
954 method set_sslcerttype : string -> unit
955 method set_sslcertpasswd : string -> unit
956 method set_sslkey : string -> unit
957 method set_sslkeytype : string -> unit
958 method set_sslkeypasswd : string -> unit
959 method set_sslengine : string -> unit
960 method set_sslenginedefault : bool -> unit
961 method set_certinfo : bool -> unit
962 method set_crlf : bool -> unit
963 method set_quote : string list -> unit
964 method set_postquote : string list -> unit
965 method set_headerfunction: (string -> int) -> unit
966 method set_cookiefile : string -> unit
967 method set_sslversion : curlSSLVersion -> unit
968 method set_timecondition : curlTimeCondition -> unit
969 method set_timevalue : int32 -> unit
970 method set_customrequest : string -> unit
971 method set_interface : string -> unit
972 method set_krb4level : curlKRB4Level -> unit
973 method set_progressfunction :
974 (float -> float -> float -> float -> bool) -> unit
975 method set_xferinfofunction :
976 (int64 -> int64 -> int64 -> int64 -> bool) -> unit
977 method set_prereqfunction :
978 (string -> string -> int -> int -> bool) -> unit
979 method set_sslverifypeer : bool -> unit
980 method set_cainfo : string -> unit
981 method set_capath : string -> unit
982 method set_filetime : bool -> unit
983 method set_maxredirs : int -> unit
984 method set_maxconnects : int -> unit
985 method set_closepolicy : curlClosePolicy -> unit
986 method set_freshconnect : bool -> unit
987 method set_forbidreuse : bool -> unit
988 method set_randomfile : string -> unit
989 method set_egdsocket : string -> unit
990 method set_connecttimeout : int -> unit
991 method set_httpget : bool -> unit
992 method set_sslverifyhost : curlSSLVerifyHost -> unit
993 method set_cookiejar : string -> unit
994 method set_sslcipherlist : string -> unit
995 method set_httpversion : curlHTTPVersion -> unit
996 method set_ftpuseepsv : bool -> unit
997 method set_dnscachetimeout : int -> unit
998 method set_dnsuseglobalcache : bool -> unit
999 method set_debugfunction : (t -> curlDebugType -> string -> unit) -> unit
1000 method set_private : string -> unit
1001 method set_http200aliases : string list -> unit
1002 method set_unrestrictedauth : bool -> unit
1003 method set_ftpuseeprt : bool -> unit
1004 method set_httpauth : curlAuth list -> unit
1005 method set_ftpcreatemissingdirs : bool -> unit
1006 method set_proxyauth : curlAuth list -> unit
1007 method set_ftpresponsetimeout : int -> unit
1008 method set_ipresolve : curlIPResolve -> unit
1009 method set_maxfilesize : int32 -> unit
1010 method set_infilesizelarge : int64 -> unit
1011 method set_resumefromlarge : int64 -> unit
1012 method set_maxfilesizelarge : int64 -> unit
1013 method set_netrcfile : string -> unit
1014 method set_ftpssl : curlFTPSSL -> unit
1015 method set_postfieldsizelarge : int64 -> unit
1016 method set_tcpnodelay : bool -> unit
1017 method set_tcpfastopen : bool -> unit
1018 method set_ftpsslauth : curlFTPSSLAuth -> unit
1019 method set_ioctlfunction : (t -> curlIOCmd -> curlIOErr) -> unit
1020 method set_ftpaccount : string -> unit
1021 method set_cookielist : string -> unit
1022 method set_ignorecontentlength : bool -> unit
1023 method set_ftpskippasvip : bool -> unit
1024 method set_ftpfilemethod : curlFTPMethod -> unit
1025 method set_localport : int -> unit
1026 method set_localportrange : int -> unit
1027 method set_connectonly : bool -> unit
1028 method set_maxsendspeedlarge : int64 -> unit
1029 method set_maxrecvspeedlarge : int64 -> unit
1030 method set_ftpalternativetouser : string -> unit
1031 method set_sslsessionidcache : bool -> unit
1032 method set_sshauthtypes : curlSSHAuthTypes list -> unit
1033 method set_sshpublickeyfile : string -> unit
1034 method set_sshprivatekeyfile : string -> unit
1035 method set_ftpsslccc : curlFTPSSLCCC -> unit
1036 method set_timeoutms : int -> unit
1037 method set_connecttimeoutms : int -> unit
1038 method set_httptransferdecoding : bool -> unit
1039 method set_httpcontentdecoding : bool -> unit
1040 method set_newfileperms : int -> unit
1041 method set_newdirectoryperms : int -> unit
1042 method set_post301 : bool -> unit
1043 method set_sshhostpublickeymd5 : string -> unit
1044 method set_copypostfields : string -> unit
1045 method set_proxytransfermode : bool -> unit
1046 method set_seekfunction : (int64 -> curlSeek -> curlSeekResult) -> unit
1047 method set_autoreferer : bool -> unit
1048 method set_opensocketfunction : (Unix.file_descr -> unit) -> unit
1049 (* method set_closesocketfunction : (Unix.file_descr -> unit) -> unit *)
1050 method set_proxytype : curlProxyType -> unit
1051 method set_resolve : (string * int * string) list -> (string * int) list -> unit
1052 method set_dns_servers : string list -> unit
1053 method set_mimepost : curlMIMEPart list -> unit
1054 method set_sshknownhosts : string -> unit
1055 method set_sshkeyfunction : (curlKHMatch -> string -> curlKHStat) -> unit
1056 method set_buffersize : int -> unit
1057 method set_doh_url : string -> unit
1058 method set_ssl_options : curlSslOption list -> unit
1059 method set_aws_sigv4 : string -> unit
1060 method set_tcpkeepalive : bool -> unit
1061 method set_tcpkeepidle : int -> unit
1062 method set_tcpkeepintvl : int -> unit
1064 method get_effectiveurl : string
1065 method get_redirecturl : string
1066 method get_httpcode : int
1067 method get_responsecode : int
1068 method get_totaltime : float
1069 method get_namelookuptime : float
1070 method get_connecttime : float
1071 method get_pretransfertime : float
1072 method get_sizeupload : float
1073 method get_sizedownload : float
1074 method get_speeddownload : float
1075 method get_speedupload : float
1076 method get_headersize : int
1077 method get_requestsize : int
1078 method get_sslverifyresult : int
1079 method get_filetime : float
1080 method get_contentlengthdownload : float
1081 method get_contentlengthupload : float
1082 method get_starttransfertime : float
1083 method get_contenttype : string
1084 method get_redirecttime : float
1085 method get_redirectcount : int
1086 method get_private : string
1087 method get_httpconnectcode : int
1088 method get_httpauthavail : curlAuth list
1089 method get_proxyauthavail : curlAuth list
1090 method get_oserrno : int
1091 method get_numconnects : int
1092 method get_sslengines : string list
1093 method get_cookielist : string list
1094 method get_lastsocket : int
1095 method get_activesocket : Unix.file_descr option
1096 method get_ftpentrypath : string
1097 method get_primaryip : string
1098 method get_localip : string
1099 method get_localport : int
1100 method get_conditionunmet : bool
1101 method get_certinfo : string list list
1102 method get_http_version : curlHTTPVersion
1105 (** {2 curl_multi API} *)
1107 (** Curl multi stack. Functions may raise [Failure] on critical errors *)
1108 module Multi : sig
1110 (** type of Curl multi stack *)
1111 type mt
1113 type curlPipelining = PIPE_NOTHING | PIPE_HTTP1 | PIPE_MULTIPLEX
1115 type curlMultiOption =
1116 | CURLMOPT_PIPELINING of curlPipelining list
1117 | CURLMOPT_MAXCONNECTS of int
1118 | CURLMOPT_MAX_PIPELINE_LENGTH of int
1119 | CURLMOPT_MAX_HOST_CONNECTIONS of int
1120 | CURLMOPT_MAX_TOTAL_CONNECTIONS of int
1122 (** exception raised on internal errors *)
1123 exception Error of string
1125 type cerror
1127 val int_of_cerror: cerror -> int
1129 (** exception raised on libcurl errors : origin * code * message *)
1130 exception CError of string * cerror * string
1132 (** create new multi stack *)
1133 val create : unit -> mt
1135 (** add handle to multi stack *)
1136 val add : mt -> t -> unit
1138 (** remove handle from multi stack (effectively halting the transfer) *)
1139 val remove : mt -> t -> unit
1141 (** perform pending data transfers (if any) on all handles currently in multi stack
1142 @return the number of handles that still transfer data *)
1143 val perform : mt -> int
1145 type waitfd_event =
1146 | CURL_WAIT_POLLIN
1147 | CURL_WAIT_POLLPRI
1148 | CURL_WAIT_POLLOUT
1150 type waitfd
1152 val waitfd: Unix.file_descr -> waitfd_event list -> waitfd
1153 val waitfd_fd: waitfd -> Unix.file_descr
1154 val waitfd_isset: waitfd -> waitfd_event -> bool
1156 (** wait till there are some active data transfers on multi stack
1157 @return whether [perform] should be called *)
1158 val wait : ?timeout_ms:int -> ?extra_fds:waitfd list -> mt -> bool
1160 (** poll till there are some active data transfers on multi stack.
1161 Contrary to [wait], this function does not return immediately
1162 when there are no pending transfer but waits for [timeout_ms]
1163 The module falls back to [wait] if this function is unavailable.
1164 @return whether [perform] should be called *)
1165 val poll : ?timeout_ms:int -> ?extra_fds:waitfd list -> mt -> bool
1167 (** remove finished handle from the multi stack if any. The returned handle may be reused *)
1168 val remove_finished : mt -> (t * curlCode) option
1170 (** destroy multi handle (all transfers are stopped, but individual {!type: Curl.t} handles can be reused) *)
1171 val cleanup : mt -> unit
1173 (** events that should be reported for the socket *)
1174 type poll =
1175 | POLL_NONE (** none *)
1176 | POLL_IN (** available for reading *)
1177 | POLL_OUT (** available for writing *)
1178 | POLL_INOUT (** both *)
1179 | POLL_REMOVE (** socket not needed anymore *)
1181 (** socket status *)
1182 type fd_status =
1183 | EV_AUTO (** determine socket status automatically (with extra system call) *)
1184 | EV_IN (** socket has incoming data *)
1185 | EV_OUT (** socket is available for writing *)
1186 | EV_INOUT (** both *)
1188 (** set the function to receive notifications on what socket events
1189 are currently interesting for libcurl on the specified socket handle *)
1190 val set_socket_function : mt -> (Unix.file_descr -> poll -> unit) -> unit
1192 (** set the function to receive notification when libcurl internal timeout changes,
1193 timeout value is in milliseconds
1195 NB {!action_timeout} should be called when timeout occurs *)
1196 val set_timer_function : mt -> (int -> unit) -> unit
1198 (** perform pending data transfers (if any) on all handles currently in multi stack
1199 (not recommended, {!action} should be used instead)
1200 @return the number of handles that still transfer data
1201 @raise Error on errors
1203 val action_all : mt -> int
1205 (** inform libcurl that timeout occured
1206 @raise Error on errors
1208 val action_timeout : mt -> unit
1210 (** [action mt fd status] informs libcurl about event on the specified socket.
1211 [status] specifies socket status. Perform pending data transfers.
1212 @return the number of handles still active
1213 @raise Error on errors
1215 val action : mt -> Unix.file_descr -> fd_status -> int
1217 (** [timeout mt] polls multi handle for timeout (not recommended, use {!set_timer_function} instead).
1218 @return maximum allowed number of milliseconds to wait before calling libcurl to perform actions
1219 @raise Error on errors
1221 external timeout : mt -> int = "caml_curl_multi_timeout"
1223 (** @raise NotImplemented for not implemented option *)
1224 val setopt : mt -> curlMultiOption -> unit