package ocurl

  1. Overview
  2. Docs

libcurl wrapper

Types

type t
type curlCode =
  1. | CURLE_OK
  2. | CURLE_UNSUPPORTED_PROTOCOL
  3. | CURLE_FAILED_INIT
  4. | CURLE_URL_MALFORMAT
  5. | CURLE_URL_MALFORMAT_USER
  6. | CURLE_COULDNT_RESOLVE_PROXY
  7. | CURLE_COULDNT_RESOLVE_HOST
  8. | CURLE_COULDNT_CONNECT
  9. | CURLE_FTP_WEIRD_SERVER_REPLY
  10. | CURLE_FTP_ACCESS_DENIED
  11. | CURLE_FTP_USER_PASSWORD_INCORRECT
  12. | CURLE_FTP_WEIRD_PASS_REPLY
  13. | CURLE_FTP_WEIRD_USER_REPLY
  14. | CURLE_FTP_WEIRD_PASV_REPLY
  15. | CURLE_FTP_WEIRD_227_FORMAT
  16. | CURLE_FTP_CANT_GET_HOST
  17. | CURLE_FTP_CANT_RECONNECT
  18. | CURLE_FTP_COULDNT_SET_BINARY
  19. | CURLE_PARTIAL_FILE
  20. | CURLE_FTP_COULDNT_RETR_FILE
  21. | CURLE_FTP_WRITE_ERROR
  22. | CURLE_FTP_QUOTE_ERROR
  23. | CURLE_HTTP_NOT_FOUND
  24. | CURLE_WRITE_ERROR
  25. | CURLE_MALFORMAT_USER
  26. | CURLE_FTP_COULDNT_STOR_FILE
  27. | CURLE_READ_ERROR
  28. | CURLE_OUT_OF_MEMORY
  29. | CURLE_OPERATION_TIMEOUTED
  30. | CURLE_FTP_COULDNT_SET_ASCII
  31. | CURLE_FTP_PORT_FAILED
  32. | CURLE_FTP_COULDNT_USE_REST
  33. | CURLE_FTP_COULDNT_GET_SIZE
  34. | CURLE_HTTP_RANGE_ERROR
  35. | CURLE_HTTP_POST_ERROR
  36. | CURLE_SSL_CONNECT_ERROR
  37. | CURLE_FTP_BAD_DOWNLOAD_RESUME
  38. | CURLE_FILE_COULDNT_READ_FILE
  39. | CURLE_LDAP_CANNOT_BIND
  40. | CURLE_LDAP_SEARCH_FAILED
  41. | CURLE_LIBRARY_NOT_FOUND
  42. | CURLE_FUNCTION_NOT_FOUND
  43. | CURLE_ABORTED_BY_CALLBACK
  44. | CURLE_BAD_FUNCTION_ARGUMENT
  45. | CURLE_BAD_CALLING_ORDER
  46. | CURLE_HTTP_PORT_FAILED
  47. | CURLE_BAD_PASSWORD_ENTERED
  48. | CURLE_TOO_MANY_REDIRECTS
  49. | CURLE_UNKNOWN_TELNET_OPTION
  50. | CURLE_TELNET_OPTION_SYNTAX
  51. | CURLE_OBSOLETE
  52. | CURLE_SSL_PEER_CERTIFICATE
  53. | CURLE_GOT_NOTHING
  54. | CURLE_SSL_ENGINE_NOTFOUND
  55. | CURLE_SSL_ENGINE_SETFAILED
  56. | CURLE_SEND_ERROR
  57. | CURLE_RECV_ERROR
  58. | CURLE_SHARE_IN_USE
  59. | CURLE_SSL_CERTPROBLEM
  60. | CURLE_SSL_CIPHER
  61. | CURLE_SSL_CACERT
  62. | CURLE_BAD_CONTENT_ENCODING
  63. | CURLE_LDAP_INVALID_URL
  64. | CURLE_FILESIZE_EXCEEDED
  65. | CURLE_USE_SSL_FAILED
  66. | CURLE_SEND_FAIL_REWIND
  67. | CURLE_SSL_ENGINE_INITFAILED
  68. | CURLE_LOGIN_DENIED
  69. | CURLE_TFTP_NOTFOUND
  70. | CURLE_TFTP_PERM
  71. | CURLE_REMOTE_DISK_FULL
  72. | CURLE_TFTP_ILLEGAL
  73. | CURLE_TFTP_UNKNOWNID
  74. | CURLE_REMOTE_FILE_EXISTS
  75. | CURLE_TFTP_NOSUCHUSER
  76. | CURLE_CONV_FAILED
  77. | CURLE_CONV_REQD
  78. | CURLE_SSL_CACERT_BADFILE
  79. | CURLE_REMOTE_FILE_NOT_FOUND
  80. | CURLE_SSH
  81. | CURLE_SSL_SHUTDOWN_FAILED
  82. | CURLE_AGAIN
exception CurlException of curlCode * int * string
exception NotImplemented of string

exception raised when trying to use options missing from libcurl headers, argument is the option name

type curlNETRCOption =
  1. | CURL_NETRC_OPTIONAL
  2. | CURL_NETRC_IGNORED
  3. | CURL_NETRC_REQUIRED
type curlEncoding =
  1. | CURL_ENCODING_NONE
  2. | CURL_ENCODING_DEFLATE
  3. | CURL_ENCODING_GZIP
  4. | CURL_ENCODING_ANY
type curlContentType =
  1. | DEFAULT
  2. | CONTENTTYPE of string
type curlHTTPPost =
  1. | CURLFORM_CONTENT of string * string * curlContentType
  2. | CURLFORM_FILECONTENT of string * string * curlContentType
  3. | CURLFORM_FILE of string * string * curlContentType
  4. | CURLFORM_BUFFER of string * string * string * curlContentType
type curlSSLVersion =
  1. | SSLVERSION_DEFAULT
    (*

    attempt to figure out the remote SSL protocol version

    *)
  2. | SSLVERSION_TLSv1
    (*

    TLSv1.x

    *)
  3. | SSLVERSION_SSLv2
    (*

    SSLv2

    *)
  4. | SSLVERSION_SSLv3
    (*

    SSLv3

    *)
  5. | SSLVERSION_TLSv1_0
    (*

    Added in libcurl 7.34.0, will request TLSv1.x in previous versions

    *)
  6. | SSLVERSION_TLSv1_1
    (*

    Added in libcurl 7.34.0, will request TLSv1.x in previous versions

    *)
  7. | SSLVERSION_TLSv1_2
    (*

    Added in libcurl 7.34.0, will request TLSv1.x in previous versions

    *)
  8. | SSLVERSION_TLSv1_3
    (*

    Added in libcurl 7.52.0, will request TLSv1.x in previous versions

    *)
type curlTimeCondition =
  1. | TIMECOND_NONE
    (*

    since 0.6.1

    *)
  2. | TIMECOND_IFMODSINCE
  3. | TIMECOND_IFUNMODSINCE
  4. | TIMECOND_LASTMOD
    (*

    since 0.6.1

    *)
type curlKRB4Level =
  1. | KRB4_NONE
  2. | KRB4_CLEAR
  3. | KRB4_SAFE
  4. | KRB4_CONFIDENTIAL
  5. | KRB4_PRIVATE
type curlClosePolicy =
  1. | CLOSEPOLICY_OLDEST
  2. | CLOSEPOLICY_LEAST_RECENTLY_USED
type curlSSLVerifyHost =
  1. | SSLVERIFYHOST_NONE
    (*

    connection succeeds regardless of the names in the certificate

    *)
  2. | SSLVERIFYHOST_EXISTENCE
    (*

    deprecated, equivalent to SSLVERIFYHOST_HOSTNAME

    *)
  3. | SSLVERIFYHOST_HOSTNAME
    (*

    certificate must indicate the matching hostname, or the connection fails

    *)
type curlHTTPVersion =
  1. | HTTP_VERSION_NONE
    (*

    libcurl will make the best choice

    *)
  2. | HTTP_VERSION_1_0
    (*

    please use HTTP 1.0

    *)
  3. | HTTP_VERSION_1_1
    (*

    please use HTTP 1.1

    *)
  4. | HTTP_VERSION_2
    (*

    please use HTTP 2

    *)
  5. | HTTP_VERSION_2TLS
    (*

    use version 2 for HTTPS, version 1.1 for HTTP

    *)
type curlDebugType =
  1. | DEBUGTYPE_TEXT
  2. | DEBUGTYPE_HEADER_IN
  3. | DEBUGTYPE_HEADER_OUT
  4. | DEBUGTYPE_DATA_IN
  5. | DEBUGTYPE_DATA_OUT
  6. | DEBUGTYPE_SSL_DATA_IN
  7. | DEBUGTYPE_SSL_DATA_OUT
  8. | DEBUGTYPE_END
type curlAuth =
  1. | CURLAUTH_BASIC
  2. | CURLAUTH_DIGEST
  3. | CURLAUTH_GSSNEGOTIATE
  4. | CURLAUTH_NTLM
  5. | CURLAUTH_ANY
  6. | CURLAUTH_ANYSAFE
type curlIPResolve =
  1. | IPRESOLVE_WHATEVER
  2. | IPRESOLVE_V4
  3. | IPRESOLVE_V6
type curlFTPSSL =
  1. | FTPSSL_NONE
  2. | FTPSSL_TRY
  3. | FTPSSL_CONTROL
  4. | FTPSSL_ALL
type curlFTPSSLAuth =
  1. | FTPAUTH_DEFAULT
  2. | FTPAUTH_SSL
  3. | FTPAUTH_TLS
type curlIOCmd =
  1. | IOCMD_NOP
  2. | IOCMD_RESTARTREAD
type curlIOErr =
  1. | IOE_OK
  2. | IOE_UNKNOWNCMD
  3. | IOE_FAILRESTART
type curlSeekResult =
  1. | SEEKFUNC_OK
  2. | SEEKFUNC_FAIL
  3. | SEEKFUNC_CANTSEEK
type curlFTPMethod =
  1. | FTPMETHOD_DEFAULT
  2. | FTPMETHOD_MULTICWD
  3. | FTPMETHOD_NOCWD
  4. | FTPMETHOD_SINGLECWD
type curlSSHAuthTypes =
  1. | SSHAUTH_ANY
  2. | SSHAUTH_PUBLICKEY
  3. | SSHAUTH_PASSWORD
  4. | SSHAUTH_HOST
  5. | SSHAUTH_KEYBOARD
type curlFTPSSLCCC =
  1. | FTPSSL_CCC_NONE
  2. | FTPSSL_CCC_PASSIVE
  3. | FTPSSL_CCC_ACTIVE
type curlSeek =
  1. | SEEK_SET
  2. | SEEK_CUR
  3. | SEEK_END
type curlProxyType =
  1. | CURLPROXY_HTTP
  2. | CURLPROXY_HTTP_1_0
    (*

    since libcurl 7.19.4

    *)
  3. | CURLPROXY_SOCKS4
    (*

    since libcurl 7.15.2

    *)
  4. | CURLPROXY_SOCKS5
  5. | CURLPROXY_SOCKS4A
    (*

    since libcurl 7.18.0

    *)
  6. | CURLPROXY_SOCKS5_HOSTNAME
    (*

    since libcurl 7.18.0

    *)
type curlProto =
  1. | CURLPROTO_ALL
    (*

    enable everything

    *)
  2. | CURLPROTO_HTTP
  3. | CURLPROTO_HTTPS
  4. | CURLPROTO_FTP
  5. | CURLPROTO_FTPS
  6. | CURLPROTO_SCP
  7. | CURLPROTO_SFTP
  8. | CURLPROTO_TELNET
  9. | CURLPROTO_LDAP
  10. | CURLPROTO_LDAPS
  11. | CURLPROTO_DICT
  12. | CURLPROTO_FILE
  13. | CURLPROTO_TFTP
  14. | CURLPROTO_IMAP
  15. | CURLPROTO_IMAPS
  16. | CURLPROTO_POP3
  17. | CURLPROTO_POP3S
  18. | CURLPROTO_SMTP
  19. | CURLPROTO_SMTPS
  20. | CURLPROTO_RTSP
  21. | CURLPROTO_RTMP
  22. | CURLPROTO_RTMPT
  23. | CURLPROTO_RTMPE
  24. | CURLPROTO_RTMPTE
  25. | CURLPROTO_RTMPS
  26. | CURLPROTO_RTMPTS
  27. | CURLPROTO_GOPHER

Protocols to enable (via CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS)

type curlOption =
  1. | CURLOPT_WRITEFUNCTION of string -> int
  2. | CURLOPT_READFUNCTION of int -> string
  3. | CURLOPT_INFILESIZE of int
  4. | CURLOPT_URL of string
  5. | CURLOPT_PROXY of string
  6. | CURLOPT_PROXYPORT of int
  7. | CURLOPT_HTTPPROXYTUNNEL of bool
  8. | CURLOPT_VERBOSE of bool
  9. | CURLOPT_HEADER of bool
  10. | CURLOPT_NOPROGRESS of bool
  11. | CURLOPT_NOSIGNAL of bool
  12. | CURLOPT_NOBODY of bool
  13. | CURLOPT_FAILONERROR of bool
  14. | CURLOPT_UPLOAD of bool
  15. | CURLOPT_POST of bool
  16. | CURLOPT_FTPLISTONLY of bool
  17. | CURLOPT_FTPAPPEND of bool
  18. | CURLOPT_NETRC of curlNETRCOption
  19. | CURLOPT_ENCODING of curlEncoding
  20. | CURLOPT_FOLLOWLOCATION of bool
  21. | CURLOPT_TRANSFERTEXT of bool
  22. | CURLOPT_PUT of bool
  23. | CURLOPT_USERPWD of string
  24. | CURLOPT_PROXYUSERPWD of string
  25. | CURLOPT_RANGE of string
  26. | CURLOPT_ERRORBUFFER of string Stdlib.ref
  27. | CURLOPT_TIMEOUT of int
  28. | CURLOPT_POSTFIELDS of string
  29. | CURLOPT_POSTFIELDSIZE of int
  30. | CURLOPT_REFERER of string
  31. | CURLOPT_USERAGENT of string
  32. | CURLOPT_FTPPORT of string
  33. | CURLOPT_LOWSPEEDLIMIT of int
  34. | CURLOPT_LOWSPEEDTIME of int
  35. | CURLOPT_RESUMEFROM of int
  36. | CURLOPT_HTTPHEADER of string list
  37. | CURLOPT_HTTPPOST of curlHTTPPost list
  38. | CURLOPT_SSLCERT of string
  39. | CURLOPT_SSLCERTTYPE of string
  40. | CURLOPT_SSLCERTPASSWD of string
  41. | CURLOPT_SSLKEY of string
  42. | CURLOPT_SSLKEYTYPE of string
  43. | CURLOPT_SSLKEYPASSWD of string
  44. | CURLOPT_SSLENGINE of string
  45. | CURLOPT_SSLENGINEDEFAULT of bool
  46. | CURLOPT_CRLF of bool
  47. | CURLOPT_QUOTE of string list
  48. | CURLOPT_POSTQUOTE of string list
  49. | CURLOPT_HEADERFUNCTION of string -> int
  50. | CURLOPT_COOKIEFILE of string
  51. | CURLOPT_SSLVERSION of curlSSLVersion
  52. | CURLOPT_TIMECONDITION of curlTimeCondition
  53. | CURLOPT_TIMEVALUE of int32
  54. | CURLOPT_CUSTOMREQUEST of string
  55. | CURLOPT_INTERFACE of string
  56. | CURLOPT_KRB4LEVEL of curlKRB4Level
  57. | CURLOPT_PROGRESSFUNCTION of float -> float -> float -> float -> bool
  58. | CURLOPT_SSLVERIFYPEER of bool
  59. | CURLOPT_CAINFO of string
  60. | CURLOPT_CAPATH of string
  61. | CURLOPT_FILETIME of bool
  62. | CURLOPT_MAXREDIRS of int
  63. | CURLOPT_MAXCONNECTS of int
  64. | CURLOPT_CLOSEPOLICY of curlClosePolicy
  65. | CURLOPT_FRESHCONNECT of bool
  66. | CURLOPT_FORBIDREUSE of bool
  67. | CURLOPT_RANDOMFILE of string
  68. | CURLOPT_EGDSOCKET of string
  69. | CURLOPT_CONNECTTIMEOUT of int
  70. | CURLOPT_HTTPGET of bool
  71. | CURLOPT_SSLVERIFYHOST of curlSSLVerifyHost
  72. | CURLOPT_COOKIEJAR of string
  73. | CURLOPT_SSLCIPHERLIST of string
  74. | CURLOPT_HTTPVERSION of curlHTTPVersion
  75. | CURLOPT_FTPUSEEPSV of bool
  76. | CURLOPT_DNSCACHETIMEOUT of int
  77. | CURLOPT_DNSUSEGLOBALCACHE of bool
  78. | CURLOPT_DEBUGFUNCTION of t -> curlDebugType -> string -> unit
  79. | CURLOPT_PRIVATE of string
    (*

    doesn't employ libcurl's CURLOPT_PRIVATE

    *)
  80. | CURLOPT_HTTP200ALIASES of string list
  81. | CURLOPT_UNRESTRICTEDAUTH of bool
  82. | CURLOPT_FTPUSEEPRT of bool
  83. | CURLOPT_HTTPAUTH of curlAuth list
  84. | CURLOPT_FTPCREATEMISSINGDIRS of bool
  85. | CURLOPT_PROXYAUTH of curlAuth list
  86. | CURLOPT_FTPRESPONSETIMEOUT of int
  87. | CURLOPT_IPRESOLVE of curlIPResolve
  88. | CURLOPT_MAXFILESIZE of int32
  89. | CURLOPT_INFILESIZELARGE of int64
  90. | CURLOPT_RESUMEFROMLARGE of int64
  91. | CURLOPT_MAXFILESIZELARGE of int64
  92. | CURLOPT_NETRCFILE of string
  93. | CURLOPT_FTPSSL of curlFTPSSL
  94. | CURLOPT_POSTFIELDSIZELARGE of int64
  95. | CURLOPT_TCPNODELAY of bool
  96. | CURLOPT_FTPSSLAUTH of curlFTPSSLAuth
  97. | CURLOPT_IOCTLFUNCTION of t -> curlIOCmd -> curlIOErr
  98. | CURLOPT_FTPACCOUNT of string
  99. | CURLOPT_COOKIELIST of string
  100. | CURLOPT_IGNORECONTENTLENGTH of bool
  101. | CURLOPT_FTPSKIPPASVIP of bool
  102. | CURLOPT_FTPFILEMETHOD of curlFTPMethod
  103. | CURLOPT_LOCALPORT of int
  104. | CURLOPT_LOCALPORTRANGE of int
  105. | CURLOPT_CONNECTONLY of bool
  106. | CURLOPT_MAXSENDSPEEDLARGE of int64
  107. | CURLOPT_MAXRECVSPEEDLARGE of int64
  108. | CURLOPT_FTPALTERNATIVETOUSER of string
  109. | CURLOPT_SSLSESSIONIDCACHE of bool
  110. | CURLOPT_SSHAUTHTYPES of curlSSHAuthTypes list
  111. | CURLOPT_SSHPUBLICKEYFILE of string
  112. | CURLOPT_SSHPRIVATEKEYFILE of string
  113. | CURLOPT_FTPSSLCCC of curlFTPSSLCCC
  114. | CURLOPT_TIMEOUTMS of int
  115. | CURLOPT_CONNECTTIMEOUTMS of int
  116. | CURLOPT_HTTPTRANSFERDECODING of bool
  117. | CURLOPT_HTTPCONTENTDECODING of bool
  118. | CURLOPT_NEWFILEPERMS of int
  119. | CURLOPT_NEWDIRECTORYPERMS of int
  120. | CURLOPT_POST301 of bool
  121. | CURLOPT_SSHHOSTPUBLICKEYMD5 of string
  122. | CURLOPT_COPYPOSTFIELDS of string
  123. | CURLOPT_PROXYTRANSFERMODE of bool
  124. | CURLOPT_SEEKFUNCTION of int64 -> curlSeek -> curlSeekResult
  125. | CURLOPT_AUTOREFERER of bool
  126. | CURLOPT_OPENSOCKETFUNCTION of Unix.file_descr -> unit
  127. | CURLOPT_PROXYTYPE of curlProxyType
  128. | CURLOPT_PROTOCOLS of curlProto list
  129. | CURLOPT_REDIR_PROTOCOLS of curlProto list
  130. | CURLOPT_RESOLVE of string list
  131. | CURLOPT_DNS_SERVERS of string
  132. | CURLOPT_MAIL_FROM of string
  133. | CURLOPT_MAIL_RCPT of string list
  134. | CURLOPT_PIPEWAIT of bool
  135. | CURLOPT_CERTINFO of bool
  136. | CURLOPT_USERNAME of string
  137. | CURLOPT_PASSWORD of string
  138. | CURLOPT_LOGIN_OPTIONS of string
  139. | CURLOPT_CONNECT_TO of string list
type initOption =
  1. | CURLINIT_GLOBALALL
  2. | CURLINIT_GLOBALSSL
  3. | CURLINIT_GLOBALWIN32
  4. | CURLINIT_GLOBALNOTHING
type curlInfo =
  1. | CURLINFO_EFFECTIVE_URL
  2. | CURLINFO_HTTP_CODE
  3. | CURLINFO_RESPONSE_CODE
  4. | CURLINFO_TOTAL_TIME
  5. | CURLINFO_NAMELOOKUP_TIME
  6. | CURLINFO_CONNECT_TIME
  7. | CURLINFO_PRETRANSFER_TIME
  8. | CURLINFO_SIZE_UPLOAD
  9. | CURLINFO_SIZE_DOWNLOAD
  10. | CURLINFO_SPEED_DOWNLOAD
  11. | CURLINFO_SPEED_UPLOAD
  12. | CURLINFO_HEADER_SIZE
  13. | CURLINFO_REQUEST_SIZE
  14. | CURLINFO_SSL_VERIFYRESULT
  15. | CURLINFO_FILETIME
  16. | CURLINFO_CONTENT_LENGTH_DOWNLOAD
  17. | CURLINFO_CONTENT_LENGTH_UPLOAD
  18. | CURLINFO_STARTTRANSFER_TIME
  19. | CURLINFO_CONTENT_TYPE
  20. | CURLINFO_REDIRECT_TIME
  21. | CURLINFO_REDIRECT_COUNT
  22. | CURLINFO_PRIVATE
    (*

    returns value previously set with CURLOPT_PRIVATE, doesn't employ libcurl's CURLINFO_PRIVATE

    *)
  23. | CURLINFO_HTTP_CONNECTCODE
  24. | CURLINFO_HTTPAUTH_AVAIL
  25. | CURLINFO_PROXYAUTH_AVAIL
  26. | CURLINFO_OS_ERRNO
  27. | CURLINFO_NUM_CONNECTS
  28. | CURLINFO_SSL_ENGINES
  29. | CURLINFO_COOKIELIST
  30. | CURLINFO_LASTSOCKET
  31. | CURLINFO_FTP_ENTRY_PATH
  32. | CURLINFO_REDIRECT_URL
  33. | CURLINFO_PRIMARY_IP
  34. | CURLINFO_LOCAL_IP
  35. | CURLINFO_LOCAL_PORT
  36. | CURLINFO_CONDITION_UNMET
  37. | CURLINFO_CERTINFO
type curlInfoResult =
  1. | CURLINFO_String of string
  2. | CURLINFO_Long of int
  3. | CURLINFO_Double of float
  4. | CURLINFO_StringList of string list
  5. | CURLINFO_StringListList of string list list
type version_info = {
  1. version : string;
  2. number : int * int * int;
  3. host : string;
  4. features : string list;
  5. ssl_version : string option;
  6. libz_version : string option;
  7. protocols : string list;
  8. ares : string;
    (*

    starting from this field are optional features - may be empty/zero

    *)
  9. ares_num : int;
  10. libidn : string;
  11. iconv_ver_num : int;
  12. libssh_version : string;
}
type pauseOption =
  1. | PAUSE_SEND
  2. | PAUSE_RECV
  3. | PAUSE_ALL

curl_easy API

val global_init : initOption -> unit
val global_cleanup : unit -> unit
val init : unit -> t
val reset : t -> unit

Reset t to the default state

val duphandle : t -> t

Reset t to the default state

Create the new handle, copying all the options from the supplied t. Note that it will also copy set_writefunction options and alike, as such both handles (original and new one) will be referencing the same closures, potentially sharing some state, which may lead to surprising results.

val setopt : t -> curlOption -> unit

Create the new handle, copying all the options from the supplied t. Note that it will also copy set_writefunction options and alike, as such both handles (original and new one) will be referencing the same closures, potentially sharing some state, which may lead to surprising results.

val perform : t -> unit
val cleanup : t -> unit
val getinfo : t -> curlInfo -> curlInfoResult
val escape : string -> string
val unescape : string -> string
val getdate : string -> float -> float
val version : unit -> string
val strerror : curlCode -> string
val errno : curlCode -> int
val version_info : unit -> version_info
val pause : t -> pauseOption list -> unit

Set transfer options

All callback functions shouldn't raise exceptions. Any exception raised in callback function will be silently caught and discared, and transfer will be aborted.

val set_writefunction : t -> (string -> int) -> unit
val set_readfunction : t -> (int -> string) -> unit

readfunction n should return string of length at most n, otherwise transfer will be aborted (as if with exception)

val set_infilesize : t -> int -> unit

readfunction n should return string of length at most n, otherwise transfer will be aborted (as if with exception)

val set_url : t -> string -> unit
val set_proxy : t -> string -> unit
val set_proxyport : t -> int -> unit
val set_httpproxytunnel : t -> bool -> unit
val set_verbose : t -> bool -> unit
val set_header : t -> bool -> unit
val set_noprogress : t -> bool -> unit
val set_nosignal : t -> bool -> unit
val set_nobody : t -> bool -> unit
val set_failonerror : t -> bool -> unit
val set_upload : t -> bool -> unit
val set_post : t -> bool -> unit
val set_ftplistonly : t -> bool -> unit
val set_ftpappend : t -> bool -> unit
val set_netrc : t -> curlNETRCOption -> unit
val set_encoding : t -> curlEncoding -> unit
val set_followlocation : t -> bool -> unit
val set_transfertext : t -> bool -> unit
val set_put : t -> bool -> unit
val set_userpwd : t -> string -> unit
val set_proxyuserpwd : t -> string -> unit
val set_range : t -> string -> unit
val set_errorbuffer : t -> string Stdlib.ref -> unit
val set_timeout : t -> int -> unit
val set_postfields : t -> string -> unit
val set_postfieldsize : t -> int -> unit
val set_referer : t -> string -> unit
val set_useragent : t -> string -> unit
val set_ftpport : t -> string -> unit
val set_lowspeedlimit : t -> int -> unit
val set_lowspeedtime : t -> int -> unit
val set_resumefrom : t -> int -> unit
val set_httpheader : t -> string list -> unit
val set_httppost : t -> curlHTTPPost list -> unit
val set_sslcert : t -> string -> unit
val set_sslcerttype : t -> string -> unit
val set_sslcertpasswd : t -> string -> unit
val set_sslkey : t -> string -> unit
val set_sslkeytype : t -> string -> unit
val set_sslkeypasswd : t -> string -> unit
val set_sslengine : t -> string -> unit
val set_sslenginedefault : t -> bool -> unit
val set_certinfo : t -> bool -> unit
val set_crlf : t -> bool -> unit
val set_quote : t -> string list -> unit
val set_postquote : t -> string list -> unit
val set_headerfunction : t -> (string -> int) -> unit
val set_cookiefile : t -> string -> unit
val set_sslversion : t -> curlSSLVersion -> unit
val set_timecondition : t -> curlTimeCondition -> unit
val set_timevalue : t -> int32 -> unit
val set_customrequest : t -> string -> unit
val set_interface : t -> string -> unit
val set_krb4level : t -> curlKRB4Level -> unit
val set_progressfunction : t -> (float -> float -> float -> float -> bool) -> unit
val set_sslverifypeer : t -> bool -> unit
val set_cainfo : t -> string -> unit
val set_capath : t -> string -> unit
val set_filetime : t -> bool -> unit
val set_maxredirs : t -> int -> unit
val set_maxconnects : t -> int -> unit
val set_closepolicy : t -> curlClosePolicy -> unit
val set_freshconnect : t -> bool -> unit
val set_forbidreuse : t -> bool -> unit
val set_randomfile : t -> string -> unit
val set_egdsocket : t -> string -> unit
val set_connecttimeout : t -> int -> unit
val set_httpget : t -> bool -> unit
val set_sslverifyhost : t -> curlSSLVerifyHost -> unit
val set_cookiejar : t -> string -> unit
val set_sslcipherlist : t -> string -> unit
val set_httpversion : t -> curlHTTPVersion -> unit
val set_ftpuseepsv : t -> bool -> unit
val set_dnscachetimeout : t -> int -> unit
val set_dnsuseglobalcache : t -> bool -> unit
val set_debugfunction : t -> (t -> curlDebugType -> string -> unit) -> unit
val set_private : t -> string -> unit
val set_http200aliases : t -> string list -> unit
val set_unrestrictedauth : t -> bool -> unit
val set_ftpuseeprt : t -> bool -> unit
val set_httpauth : t -> curlAuth list -> unit
val set_ftpcreatemissingdirs : t -> bool -> unit
val set_proxyauth : t -> curlAuth list -> unit
val set_ftpresponsetimeout : t -> int -> unit
val set_ipresolve : t -> curlIPResolve -> unit
val set_maxfilesize : t -> int32 -> unit
val set_infilesizelarge : t -> int64 -> unit
val set_resumefromlarge : t -> int64 -> unit
val set_maxfilesizelarge : t -> int64 -> unit
val set_netrcfile : t -> string -> unit
val set_ftpssl : t -> curlFTPSSL -> unit
val set_postfieldsizelarge : t -> int64 -> unit
val set_tcpnodelay : t -> bool -> unit
val set_ftpsslauth : t -> curlFTPSSLAuth -> unit
val set_ioctlfunction : t -> (t -> curlIOCmd -> curlIOErr) -> unit
val set_ftpaccount : t -> string -> unit
val set_cookielist : t -> string -> unit
val set_ignorecontentlength : t -> bool -> unit
val set_ftpskippasvip : t -> bool -> unit
val set_ftpfilemethod : t -> curlFTPMethod -> unit
val set_localport : t -> int -> unit
val set_localportrange : t -> int -> unit
val set_connectonly : t -> bool -> unit
val set_maxsendspeedlarge : t -> int64 -> unit
val set_maxrecvspeedlarge : t -> int64 -> unit
val set_ftpalternativetouser : t -> string -> unit
val set_sslsessionidcache : t -> bool -> unit
val set_sshauthtypes : t -> curlSSHAuthTypes list -> unit
val set_sshpublickeyfile : t -> string -> unit
val set_sshprivatekeyfile : t -> string -> unit
val set_ftpsslccc : t -> curlFTPSSLCCC -> unit
val set_timeoutms : t -> int -> unit
val set_connecttimeoutms : t -> int -> unit
val set_httptransferdecoding : t -> bool -> unit
val set_httpcontentdecoding : t -> bool -> unit
val set_newfileperms : t -> int -> unit
val set_newdirectoryperms : t -> int -> unit
val set_post301 : t -> bool -> unit
val set_sshhostpublickeymd5 : t -> string -> unit
val set_copypostfields : t -> string -> unit
val set_proxytransfermode : t -> bool -> unit
val set_seekfunction : t -> (int64 -> curlSeek -> curlSeekResult) -> unit
val set_autoreferer : t -> bool -> unit
val set_opensocketfunction : t -> (Unix.file_descr -> unit) -> unit
val set_proxytype : t -> curlProxyType -> unit
val set_protocols : t -> curlProto list -> unit
val set_redirprotocols : t -> curlProto list -> unit
val set_resolve : t -> (string * int * string) list -> (string * int) list -> unit

set_resolve t add del adjusts builtin dns mapping

  • parameter add

    is the (host,port,address) list to add to dns mapping

  • parameter del

    is the (host,port) list to remove from mapping

val set_dns_servers : t -> string list -> unit
val set_mailfrom : t -> string -> unit
val set_mailrcpt : t -> string list -> unit
val set_pipewait : t -> bool -> unit
val set_username : t -> string -> unit
  • since 0.8.0
val set_password : t -> string -> unit
  • since 0.8.0
  • since 0.8.0
val set_login_options : t -> string -> unit
  • since 0.8.0
  • since 0.8.0
val set_connect_to : t -> string list -> unit
  • since 0.8.0
  • since 0.8.0

Get transfer properties

val get_effectiveurl : t -> string
val get_redirecturl : t -> string
val get_httpcode : t -> int
val get_responsecode : t -> int
val get_totaltime : t -> float
val get_namelookuptime : t -> float
val get_connecttime : t -> float
val get_pretransfertime : t -> float
val get_sizeupload : t -> float
val get_sizedownload : t -> float
val get_speeddownload : t -> float
val get_speedupload : t -> float
val get_headersize : t -> int
val get_requestsize : t -> int
val get_sslverifyresult : t -> int
val get_filetime : t -> float
val get_contentlengthdownload : t -> float
val get_contentlengthupload : t -> float
val get_starttransfertime : t -> float
val get_contenttype : t -> string
val get_redirecttime : t -> float
val get_redirectcount : t -> int
val get_private : t -> string
val get_httpconnectcode : t -> int
val get_httpauthavail : t -> curlAuth list
val get_proxyauthavail : t -> curlAuth list
val get_oserrno : t -> int
val get_numconnects : t -> int
val get_sslengines : t -> string list
val get_cookielist : t -> string list
val get_lastsocket : t -> int
val get_ftpentrypath : t -> string
val get_primaryip : t -> string
val get_localip : t -> string
  • since 0.5.5 (libcurl 7.21.0)
val get_localport : t -> int
  • since 0.5.5 (libcurl 7.21.0)
  • since 0.5.5 (libcurl 7.21.0)
val get_conditionunmet : t -> bool
  • since 0.5.5 (libcurl 7.21.0)
  • since 0.6.1 (libcurl 7.19.4)
val get_certinfo : t -> string list list
  • since 0.6.1 (libcurl 7.19.4)

Object interface

class handle : object ... end

curl_multi API

module Multi : sig ... end

Curl multi stack. Functions may raise Failure on critical errors

OCaml

Innovation. Community. Security.