package ocurl
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=99935feb1e7ff6456e33452888a3671ecb6535a303b006f24203bc54b79d2209
md5=1622d7d1777192c387cdf72567dc5b2b
doc/curl/Curl/index.html
Module Curl
libcurl wrapper
Types
type curlCode = | CURLE_OK| CURLE_UNSUPPORTED_PROTOCOL| CURLE_FAILED_INIT| CURLE_URL_MALFORMAT| CURLE_URL_MALFORMAT_USER| CURLE_COULDNT_RESOLVE_PROXY| CURLE_COULDNT_RESOLVE_HOST| CURLE_COULDNT_CONNECT| CURLE_FTP_WEIRD_SERVER_REPLY| CURLE_FTP_ACCESS_DENIED| CURLE_FTP_USER_PASSWORD_INCORRECT| CURLE_FTP_WEIRD_PASS_REPLY| CURLE_FTP_WEIRD_USER_REPLY| CURLE_FTP_WEIRD_PASV_REPLY| CURLE_FTP_WEIRD_227_FORMAT| CURLE_FTP_CANT_GET_HOST| CURLE_FTP_CANT_RECONNECT| CURLE_FTP_COULDNT_SET_BINARY| CURLE_PARTIAL_FILE| CURLE_FTP_COULDNT_RETR_FILE| CURLE_FTP_WRITE_ERROR| CURLE_FTP_QUOTE_ERROR| CURLE_HTTP_NOT_FOUND| CURLE_WRITE_ERROR| CURLE_MALFORMAT_USER| CURLE_FTP_COULDNT_STOR_FILE| CURLE_READ_ERROR| CURLE_OUT_OF_MEMORY| CURLE_OPERATION_TIMEOUTED| CURLE_FTP_COULDNT_SET_ASCII| CURLE_FTP_PORT_FAILED| CURLE_FTP_COULDNT_USE_REST| CURLE_FTP_COULDNT_GET_SIZE| CURLE_HTTP_RANGE_ERROR| CURLE_HTTP_POST_ERROR| CURLE_SSL_CONNECT_ERROR| CURLE_FTP_BAD_DOWNLOAD_RESUME| CURLE_FILE_COULDNT_READ_FILE| CURLE_LDAP_CANNOT_BIND| CURLE_LDAP_SEARCH_FAILED| CURLE_LIBRARY_NOT_FOUND| CURLE_FUNCTION_NOT_FOUND| CURLE_ABORTED_BY_CALLBACK| CURLE_BAD_FUNCTION_ARGUMENT| CURLE_BAD_CALLING_ORDER| CURLE_HTTP_PORT_FAILED| CURLE_BAD_PASSWORD_ENTERED| CURLE_TOO_MANY_REDIRECTS| CURLE_UNKNOWN_TELNET_OPTION| CURLE_TELNET_OPTION_SYNTAX| CURLE_OBSOLETE| CURLE_SSL_PEER_CERTIFICATE| CURLE_GOT_NOTHING| CURLE_SSL_ENGINE_NOTFOUND| CURLE_SSL_ENGINE_SETFAILED| CURLE_SEND_ERROR| CURLE_RECV_ERROR| CURLE_SHARE_IN_USE| CURLE_SSL_CERTPROBLEM| CURLE_SSL_CIPHER| CURLE_SSL_CACERT| CURLE_BAD_CONTENT_ENCODING| CURLE_LDAP_INVALID_URL| CURLE_FILESIZE_EXCEEDED| CURLE_USE_SSL_FAILED| CURLE_SEND_FAIL_REWIND| CURLE_SSL_ENGINE_INITFAILED| CURLE_LOGIN_DENIED| CURLE_TFTP_NOTFOUND| CURLE_TFTP_PERM| CURLE_REMOTE_DISK_FULL| CURLE_TFTP_ILLEGAL| CURLE_TFTP_UNKNOWNID| CURLE_REMOTE_FILE_EXISTS| CURLE_TFTP_NOSUCHUSER| CURLE_CONV_FAILED| CURLE_CONV_REQD| CURLE_SSL_CACERT_BADFILE| CURLE_REMOTE_FILE_NOT_FOUND| CURLE_SSH| CURLE_SSL_SHUTDOWN_FAILED| CURLE_AGAIN
exception CurlException of curlCode * int * stringexception raised when trying to use options missing from libcurl headers, argument is the option name
type curlHTTPPost = | CURLFORM_CONTENT of string * string * curlContentType| CURLFORM_FILECONTENT of string * string * curlContentType| CURLFORM_FILE of string * string * curlContentType| CURLFORM_BUFFER of string * string * string * curlContentType
type curlSSLVersion = | SSLVERSION_DEFAULT(*attempt to figure out the remote SSL protocol version
*)| SSLVERSION_TLSv1(*TLSv1.x
*)| SSLVERSION_SSLv2(*SSLv2
*)| SSLVERSION_SSLv3(*SSLv3
*)| SSLVERSION_TLSv1_0(*Added in libcurl 7.34.0, will request TLSv1.x in previous versions
*)| SSLVERSION_TLSv1_1(*Added in libcurl 7.34.0, will request TLSv1.x in previous versions
*)| SSLVERSION_TLSv1_2(*Added in libcurl 7.34.0, will request TLSv1.x in previous versions
*)| SSLVERSION_TLSv1_3(*Added in libcurl 7.52.0, will request TLSv1.x in previous versions
*)
type curlProto = | CURLPROTO_ALL(*enable everything
*)| CURLPROTO_HTTP| CURLPROTO_HTTPS| CURLPROTO_FTP| CURLPROTO_FTPS| CURLPROTO_SCP| CURLPROTO_SFTP| CURLPROTO_TELNET| CURLPROTO_LDAP| CURLPROTO_LDAPS| CURLPROTO_DICT| CURLPROTO_FILE| CURLPROTO_TFTP| CURLPROTO_IMAP| CURLPROTO_IMAPS| CURLPROTO_POP3| CURLPROTO_POP3S| CURLPROTO_SMTP| CURLPROTO_SMTPS| CURLPROTO_RTSP| CURLPROTO_RTMP| CURLPROTO_RTMPT| CURLPROTO_RTMPE| CURLPROTO_RTMPTE| CURLPROTO_RTMPS| CURLPROTO_RTMPTS| CURLPROTO_GOPHER
Protocols to enable (via CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS)
type curlOption = | CURLOPT_WRITEFUNCTION of string -> int| CURLOPT_READFUNCTION of int -> string| CURLOPT_INFILESIZE of int| CURLOPT_URL of string| CURLOPT_PROXY of string| CURLOPT_PROXYPORT of int| CURLOPT_HTTPPROXYTUNNEL of bool| CURLOPT_VERBOSE of bool| CURLOPT_HEADER of bool| CURLOPT_NOPROGRESS of bool| CURLOPT_NOSIGNAL of bool| CURLOPT_NOBODY of bool| CURLOPT_FAILONERROR of bool| CURLOPT_UPLOAD of bool| CURLOPT_POST of bool| CURLOPT_FTPLISTONLY of bool| CURLOPT_FTPAPPEND of bool| CURLOPT_NETRC of curlNETRCOption| CURLOPT_ENCODING of curlEncoding| CURLOPT_FOLLOWLOCATION of bool| CURLOPT_TRANSFERTEXT of bool| CURLOPT_PUT of bool| CURLOPT_USERPWD of string| CURLOPT_PROXYUSERPWD of string| CURLOPT_RANGE of string| CURLOPT_ERRORBUFFER of string ref| CURLOPT_TIMEOUT of int| CURLOPT_POSTFIELDS of string| CURLOPT_POSTFIELDSIZE of int| CURLOPT_REFERER of string| CURLOPT_USERAGENT of string| CURLOPT_FTPPORT of string| CURLOPT_LOWSPEEDLIMIT of int| CURLOPT_LOWSPEEDTIME of int| CURLOPT_RESUMEFROM of int| CURLOPT_COOKIE of string| CURLOPT_HTTPHEADER of string list| CURLOPT_HTTPPOST of curlHTTPPost list| CURLOPT_SSLCERT of string| CURLOPT_SSLCERTTYPE of string| CURLOPT_SSLCERTPASSWD of string| CURLOPT_SSLKEY of string| CURLOPT_SSLKEYTYPE of string| CURLOPT_SSLKEYPASSWD of string| CURLOPT_SSLENGINE of string| CURLOPT_SSLENGINEDEFAULT of bool| CURLOPT_CRLF of bool| CURLOPT_QUOTE of string list| CURLOPT_POSTQUOTE of string list| CURLOPT_HEADERFUNCTION of string -> int| CURLOPT_COOKIEFILE of string| CURLOPT_SSLVERSION of curlSSLVersion| CURLOPT_TIMECONDITION of curlTimeCondition| CURLOPT_TIMEVALUE of int32| CURLOPT_CUSTOMREQUEST of string| CURLOPT_INTERFACE of string| CURLOPT_KRB4LEVEL of curlKRB4Level| CURLOPT_PROGRESSFUNCTION of float -> float -> float -> float -> bool| CURLOPT_SSLVERIFYPEER of bool| CURLOPT_CAINFO of string| CURLOPT_CAPATH of string| CURLOPT_FILETIME of bool| CURLOPT_MAXREDIRS of int| CURLOPT_MAXCONNECTS of int| CURLOPT_CLOSEPOLICY of curlClosePolicy| CURLOPT_FRESHCONNECT of bool| CURLOPT_FORBIDREUSE of bool| CURLOPT_RANDOMFILE of string| CURLOPT_EGDSOCKET of string| CURLOPT_CONNECTTIMEOUT of int| CURLOPT_HTTPGET of bool| CURLOPT_SSLVERIFYHOST of curlSSLVerifyHost| CURLOPT_COOKIEJAR of string| CURLOPT_SSLCIPHERLIST of string| CURLOPT_HTTPVERSION of curlHTTPVersion| CURLOPT_FTPUSEEPSV of bool| CURLOPT_DNSCACHETIMEOUT of int| CURLOPT_DNSUSEGLOBALCACHE of bool| CURLOPT_DEBUGFUNCTION of t -> curlDebugType -> string -> unit| CURLOPT_PRIVATE of string(*doesn't employ libcurl's CURLOPT_PRIVATE
*)| CURLOPT_HTTP200ALIASES of string list| CURLOPT_UNRESTRICTEDAUTH of bool| CURLOPT_FTPUSEEPRT of bool| CURLOPT_HTTPAUTH of curlAuth list| CURLOPT_FTPCREATEMISSINGDIRS of bool| CURLOPT_PROXYAUTH of curlAuth list| CURLOPT_FTPRESPONSETIMEOUT of int| CURLOPT_IPRESOLVE of curlIPResolve| CURLOPT_MAXFILESIZE of int32| CURLOPT_INFILESIZELARGE of int64| CURLOPT_RESUMEFROMLARGE of int64| CURLOPT_MAXFILESIZELARGE of int64| CURLOPT_NETRCFILE of string| CURLOPT_FTPSSL of curlFTPSSL| CURLOPT_POSTFIELDSIZELARGE of int64| CURLOPT_TCPNODELAY of bool| CURLOPT_FTPSSLAUTH of curlFTPSSLAuth| CURLOPT_IOCTLFUNCTION of t -> curlIOCmd -> curlIOErr| CURLOPT_FTPACCOUNT of string| CURLOPT_COOKIELIST of string| CURLOPT_IGNORECONTENTLENGTH of bool| CURLOPT_FTPSKIPPASVIP of bool| CURLOPT_FTPFILEMETHOD of curlFTPMethod| CURLOPT_LOCALPORT of int| CURLOPT_LOCALPORTRANGE of int| CURLOPT_CONNECTONLY of bool| CURLOPT_MAXSENDSPEEDLARGE of int64| CURLOPT_MAXRECVSPEEDLARGE of int64| CURLOPT_FTPALTERNATIVETOUSER of string| CURLOPT_SSLSESSIONIDCACHE of bool| CURLOPT_SSHAUTHTYPES of curlSSHAuthTypes list| CURLOPT_SSHPUBLICKEYFILE of string| CURLOPT_SSHPRIVATEKEYFILE of string| CURLOPT_FTPSSLCCC of curlFTPSSLCCC| CURLOPT_TIMEOUTMS of int| CURLOPT_CONNECTTIMEOUTMS of int| CURLOPT_HTTPTRANSFERDECODING of bool| CURLOPT_HTTPCONTENTDECODING of bool| CURLOPT_NEWFILEPERMS of int| CURLOPT_NEWDIRECTORYPERMS of int| CURLOPT_POST301 of bool| CURLOPT_SSHHOSTPUBLICKEYMD5 of string| CURLOPT_COPYPOSTFIELDS of string| CURLOPT_PROXYTRANSFERMODE of bool| CURLOPT_SEEKFUNCTION of int64 -> curlSeek -> curlSeekResult| CURLOPT_AUTOREFERER of bool| CURLOPT_OPENSOCKETFUNCTION of Unix.file_descr -> unit| CURLOPT_PROXYTYPE of curlProxyType| CURLOPT_PROTOCOLS of curlProto list| CURLOPT_REDIR_PROTOCOLS of curlProto list| CURLOPT_RESOLVE of string list| CURLOPT_DNS_SERVERS of string| CURLOPT_MAIL_FROM of string| CURLOPT_MAIL_RCPT of string list| CURLOPT_PIPEWAIT of bool| CURLOPT_CERTINFO of bool| CURLOPT_USERNAME of string| CURLOPT_PASSWORD of string| CURLOPT_LOGIN_OPTIONS of string| CURLOPT_CONNECT_TO of string list
type curlInfo = | CURLINFO_EFFECTIVE_URL| CURLINFO_HTTP_CODE| CURLINFO_RESPONSE_CODE| CURLINFO_TOTAL_TIME| CURLINFO_NAMELOOKUP_TIME| CURLINFO_CONNECT_TIME| CURLINFO_PRETRANSFER_TIME| CURLINFO_SIZE_UPLOAD| CURLINFO_SIZE_DOWNLOAD| CURLINFO_SPEED_DOWNLOAD| CURLINFO_SPEED_UPLOAD| CURLINFO_HEADER_SIZE| CURLINFO_REQUEST_SIZE| CURLINFO_SSL_VERIFYRESULT| CURLINFO_FILETIME| CURLINFO_CONTENT_LENGTH_DOWNLOAD| CURLINFO_CONTENT_LENGTH_UPLOAD| CURLINFO_STARTTRANSFER_TIME| CURLINFO_CONTENT_TYPE| CURLINFO_REDIRECT_TIME| CURLINFO_REDIRECT_COUNT| CURLINFO_PRIVATE(*returns value previously set with CURLOPT_PRIVATE, doesn't employ libcurl's CURLINFO_PRIVATE
*)| CURLINFO_HTTP_CONNECTCODE| CURLINFO_HTTPAUTH_AVAIL| CURLINFO_PROXYAUTH_AVAIL| CURLINFO_OS_ERRNO| CURLINFO_NUM_CONNECTS| CURLINFO_SSL_ENGINES| CURLINFO_COOKIELIST| CURLINFO_LASTSOCKET| CURLINFO_FTP_ENTRY_PATH| CURLINFO_REDIRECT_URL| CURLINFO_PRIMARY_IP| CURLINFO_LOCAL_IP| CURLINFO_LOCAL_PORT| CURLINFO_CONDITION_UNMET| CURLINFO_CERTINFO
type version_info = {version : string;number : int * int * int;host : string;features : string list;ssl_version : string option;libz_version : string option;protocols : string list;ares : string;(*starting from this field are optional features - may be empty/zero
*)ares_num : int;libidn : string;iconv_ver_num : int;libssh_version : string;
}curl_easy API
val global_init : initOption -> unitval init : unit -> tval reset : t -> unitReset t to the default state
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 -> unitCreate 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 -> unitval cleanup : t -> unitval getinfo : t -> curlInfo -> curlInfoResultval strerror : curlCode -> stringval errno : curlCode -> intval version_info : unit -> version_infoval pause : t -> pauseOption list -> unitSet 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) -> unitval set_readfunction : t -> (int -> string) -> unitreadfunction n should return string of length at most n, otherwise transfer will be aborted (as if with exception)
val set_infilesize : t -> int -> unitreadfunction n should return string of length at most n, otherwise transfer will be aborted (as if with exception)
val set_url : t -> string -> unitval set_proxy : t -> string -> unitval set_proxyport : t -> int -> unitval set_httpproxytunnel : t -> bool -> unitval set_verbose : t -> bool -> unitval set_header : t -> bool -> unitval set_noprogress : t -> bool -> unitval set_nosignal : t -> bool -> unitval set_nobody : t -> bool -> unitval set_failonerror : t -> bool -> unitval set_upload : t -> bool -> unitval set_post : t -> bool -> unitval set_ftplistonly : t -> bool -> unitval set_ftpappend : t -> bool -> unitval set_netrc : t -> curlNETRCOption -> unitval set_encoding : t -> curlEncoding -> unitval set_followlocation : t -> bool -> unitval set_transfertext : t -> bool -> unitval set_put : t -> bool -> unitval set_userpwd : t -> string -> unitval set_proxyuserpwd : t -> string -> unitval set_range : t -> string -> unitval set_timeout : t -> int -> unitval set_postfields : t -> string -> unitval set_postfieldsize : t -> int -> unitval set_referer : t -> string -> unitval set_useragent : t -> string -> unitval set_ftpport : t -> string -> unitval set_lowspeedlimit : t -> int -> unitval set_lowspeedtime : t -> int -> unitval set_resumefrom : t -> int -> unitval set_cookie : t -> string -> unitval set_httpheader : t -> string list -> unitval set_httppost : t -> curlHTTPPost list -> unitval set_sslcert : t -> string -> unitval set_sslcerttype : t -> string -> unitval set_sslcertpasswd : t -> string -> unitval set_sslkey : t -> string -> unitval set_sslkeytype : t -> string -> unitval set_sslkeypasswd : t -> string -> unitval set_sslengine : t -> string -> unitval set_sslenginedefault : t -> bool -> unitval set_certinfo : t -> bool -> unitval set_crlf : t -> bool -> unitval set_quote : t -> string list -> unitval set_postquote : t -> string list -> unitval set_headerfunction : t -> (string -> int) -> unitval set_cookiefile : t -> string -> unitval set_sslversion : t -> curlSSLVersion -> unitval set_timecondition : t -> curlTimeCondition -> unitval set_timevalue : t -> int32 -> unitval set_customrequest : t -> string -> unitval set_interface : t -> string -> unitval set_krb4level : t -> curlKRB4Level -> unitval set_progressfunction :
t ->
(float -> float -> float -> float -> bool) ->
unitval set_sslverifypeer : t -> bool -> unitval set_cainfo : t -> string -> unitval set_capath : t -> string -> unitval set_filetime : t -> bool -> unitval set_maxredirs : t -> int -> unitval set_maxconnects : t -> int -> unitval set_closepolicy : t -> curlClosePolicy -> unitval set_freshconnect : t -> bool -> unitval set_forbidreuse : t -> bool -> unitval set_randomfile : t -> string -> unitval set_egdsocket : t -> string -> unitval set_connecttimeout : t -> int -> unitval set_httpget : t -> bool -> unitval set_sslverifyhost : t -> curlSSLVerifyHost -> unitval set_cookiejar : t -> string -> unitval set_sslcipherlist : t -> string -> unitval set_httpversion : t -> curlHTTPVersion -> unitval set_ftpuseepsv : t -> bool -> unitval set_dnscachetimeout : t -> int -> unitval set_dnsuseglobalcache : t -> bool -> unitval set_debugfunction : t -> (t -> curlDebugType -> string -> unit) -> unitval set_private : t -> string -> unitval set_http200aliases : t -> string list -> unitval set_unrestrictedauth : t -> bool -> unitval set_ftpuseeprt : t -> bool -> unitval set_ftpcreatemissingdirs : t -> bool -> unitval set_ftpresponsetimeout : t -> int -> unitval set_ipresolve : t -> curlIPResolve -> unitval set_maxfilesize : t -> int32 -> unitval set_infilesizelarge : t -> int64 -> unitval set_resumefromlarge : t -> int64 -> unitval set_maxfilesizelarge : t -> int64 -> unitval set_netrcfile : t -> string -> unitval set_ftpssl : t -> curlFTPSSL -> unitval set_postfieldsizelarge : t -> int64 -> unitval set_tcpnodelay : t -> bool -> unitval set_ftpsslauth : t -> curlFTPSSLAuth -> unitval set_ftpaccount : t -> string -> unitval set_cookielist : t -> string -> unitval set_ignorecontentlength : t -> bool -> unitval set_ftpskippasvip : t -> bool -> unitval set_ftpfilemethod : t -> curlFTPMethod -> unitval set_localport : t -> int -> unitval set_localportrange : t -> int -> unitval set_connectonly : t -> bool -> unitval set_maxsendspeedlarge : t -> int64 -> unitval set_maxrecvspeedlarge : t -> int64 -> unitval set_ftpalternativetouser : t -> string -> unitval set_sslsessionidcache : t -> bool -> unitval set_sshauthtypes : t -> curlSSHAuthTypes list -> unitval set_sshpublickeyfile : t -> string -> unitval set_sshprivatekeyfile : t -> string -> unitval set_ftpsslccc : t -> curlFTPSSLCCC -> unitval set_timeoutms : t -> int -> unitval set_connecttimeoutms : t -> int -> unitval set_httptransferdecoding : t -> bool -> unitval set_httpcontentdecoding : t -> bool -> unitval set_newfileperms : t -> int -> unitval set_newdirectoryperms : t -> int -> unitval set_post301 : t -> bool -> unitval set_sshhostpublickeymd5 : t -> string -> unitval set_copypostfields : t -> string -> unitval set_proxytransfermode : t -> bool -> unitval set_seekfunction : t -> (int64 -> curlSeek -> curlSeekResult) -> unitval set_autoreferer : t -> bool -> unitval set_opensocketfunction : t -> (Unix.file_descr -> unit) -> unitval set_proxytype : t -> curlProxyType -> unitval set_resolve :
t ->
(string * int * string) list ->
(string * int) list ->
unitset_resolve t add del adjusts builtin dns mapping
val set_dns_servers : t -> string list -> unitval set_mailfrom : t -> string -> unitval set_mailrcpt : t -> string list -> unitval set_pipewait : t -> bool -> unitval set_username : t -> string -> unitval set_password : t -> string -> unitval set_login_options : t -> string -> unitval set_connect_to : t -> string list -> unitGet transfer properties
val get_effectiveurl : t -> stringval get_redirecturl : t -> stringval get_httpcode : t -> intval get_responsecode : t -> intval get_totaltime : t -> floatval get_namelookuptime : t -> floatval get_connecttime : t -> floatval get_pretransfertime : t -> floatval get_sizeupload : t -> floatval get_sizedownload : t -> floatval get_speeddownload : t -> floatval get_speedupload : t -> floatval get_headersize : t -> intval get_requestsize : t -> intval get_sslverifyresult : t -> intval get_filetime : t -> floatval get_contentlengthdownload : t -> floatval get_contentlengthupload : t -> floatval get_starttransfertime : t -> floatval get_contenttype : t -> stringval get_redirecttime : t -> floatval get_redirectcount : t -> intval get_private : t -> stringval get_httpconnectcode : t -> intval get_oserrno : t -> intval get_numconnects : t -> intval get_sslengines : t -> string listval get_cookielist : t -> string listval get_lastsocket : t -> intval get_ftpentrypath : t -> stringval get_primaryip : t -> stringval get_localip : t -> stringval get_localport : t -> intval get_conditionunmet : t -> boolval get_certinfo : t -> string list listObject interface
class handle : object ... endcurl_multi API
module Multi : sig ... endCurl multi stack. Functions may raise Failure on critical errors