View source code
Display the source code in etc/c/curl.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module etc.c.curl

This is an interface to the libcurl library.

Converted to D from curl headers by htod and cleaned up by Jonas Drewsen (jdrewsen)

Windows x86 note: A DMD compatible libcurl static library can be downloaded from the dlang.org download page.

Copyright (C) 1998 - 2010, Daniel Stenberg, <[email protected]>, et al.

This software is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://curl.haxx.se/docs/copyright.html.

You may opt to use, copy, modify, merge, publish, distribute and/or sell copies of the Software, and permit persons to whom the Software is furnished to do so, under the terms of the COPYING file.

This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.

Functions

NameDescription
curl_easy_cleanup(curl)
curl_easy_duphandle(curl)
curl_easy_escape()
curl_easy_getinfo(curl, info)
curl_easy_init()
curl_easy_pause(handle, bitmask)
curl_easy_perform(curl)
curl_easy_recv(curl, buffer, buflen, n)
curl_easy_reset(curl)
curl_easy_send(curl, buffer, buflen, n)
curl_easy_setopt(curl, option)
curl_easy_strerror()
curl_easy_unescape()
curl_escape() the previous version:
curl_formadd(httppost, last_post)
curl_formfree(form)
curl_formget()
curl_free(p)
curl_getdate(p, unused)
curl_getenv()
curl_global_cleanup()
curl_global_init(flags)
curl_global_init_mem()
curl_multi_add_handle(multi_handle, curl_handle)
curl_multi_assign(multi_handle, sockfd, sockp)
curl_multi_cleanup(multi_handle)
curl_multi_fdset(multi_handle, read_fd_set, write_fd_set, exc_fd_set, max_fd)
curl_multi_info_read(multi_handle, msgs_in_queue)
curl_multi_init()
curl_multi_perform(multi_handle, running_handles)
curl_multi_remove_handle(multi_handle, curl_handle)
curl_multi_setopt(multi_handle, option)
curl_multi_socket(multi_handle, s, running_handles) ditto
curl_multi_socket_action(multi_handle, s, ev_bitmask, running_handles) ditto
curl_multi_socket_all(multi_handle, running_handles) ditto
curl_multi_strerror()
curl_multi_timeout(multi_handle, milliseconds) This macro below was added in 7.16.3 to push users who recompile to use the new curl_multi_socket_action() instead of the old curl_multi_socket()
curl_share_cleanup()
curl_share_init()
curl_share_setopt(, option)
curl_share_strerror()
curl_slist_append()
curl_slist_free_all()
curl_strequal() curl_strequal() and curl_strnequal() are subject for removal in a future libcurl, see lib/README.curlx for details
curl_strnequal() ditto
curl_unescape() the previous version
curl_version()
curl_version_info()

Structs

NameDescription
_N2 Content of this structure depends on information which is known and is achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man page for callbacks returning this structure -- some fields are mandatory, some others are optional. The FLAG field has special meaning.
_N28
curl_certinfo info about the certificate chain, only for OpenSSL builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO
curl_fileinfo Content of this structure depends on information which is known and is achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man page for callbacks returning this structure -- some fields are mandatory, some others are optional. The FLAG field has special meaning.
curl_forms structure to be used as parameter for CURLFORM_ARRAY
curl_httppost
curl_khkey
curl_slist linked-list structure for the CURLOPT_QUOTE option (and other)
curl_sockaddr addrlen was a socklen_t type before 7.18.0 but it turned really ugly and painful on the systems that lack this type
CURLMsg

Unions

NameDescription
_N31

Enums

NameDescription
CurlAuth
CurlCallbackInfo the kind of data that is passed to information_callback
CurlChunkBgnFunc return codes for CURLOPT_CHUNK_BGN_FUNCTION
CurlChunkEndFunc return codes for CURLOPT_CHUNK_END_FUNCTION
CurlClosePolicy
CurlCSelect
CurlError All possible error codes from all sorts of curl functions. Future versions may return other values, stay prepared.
CurlFileType enumeration of file types
CurlFInfoFlagKnown
CurlFnMAtchFunc return codes for FNMATCHFUNCTION
CurlFormAdd Use this for multipart formpost building
CurlFtp parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option
CurlFtpAuth parameter for the CURLOPT_FTPSSLAUTH option
CurlFtpMethod parameter for the CURLOPT_FTP_FILEMETHOD option
CurlFtpSSL parameter for the CURLOPT_FTP_SSL_CCC option
CurlGlobal
CurlHttpVersion These enums are for use with the CURLOPT_HTTP_VERSION option.
CurlInfo
CurlIoCmd
CurlIoError
CurlIpResolve Below here follows defines for the CURLOPT_IPRESOLVE option. If a host name resolves addresses using more than one IP protocol version, this option might be handy to force libcurl to use a specific IP version.
CurlKHMatch this is the set of status codes pass in to the callback
CurlKHStat this is the set of return values expected from the curl_sshkeycallback callback
CurlKHType points to a zero-terminated string encoded with base64 if len is zero, otherwise to the "raw" data
CurlLockAccess Different lock access types
CurlLockData Setup defines, protos etc for the sharing stuff.
CurlM
CurlMOption
CurlMsg
CurlNetRcOption These enums are for use with the CURLOPT_NETRC option.
CurlOption
CurlPause
CurlPoll
CurlProto CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options
CurlProxy
CurlReadFunc
CurlRedir symbols to use with CURLOPT_POSTREDIR. CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL
CurlRtspReq Public API enums for RTSP requests
CurlSeek These are the return codes for the seek callbacks
CurlSeekPos seek whence...
CurlShError
CurlShOption pass in a user data pointer used in the lock/unlock callback functions
CurlSockType
CurlSshAuth
CurlSslVersion
CurlTimeCond
CurlTlsAuth
CurlUseSSL parameter for the CURLOPT_USE_SSL option
CurlVer Structures for querying information about the curl library at runtime.
CurlVersion

Manifest constants

NameTypeDescription
CURL_ERROR_SIZE
CURL_MAX_HTTP_HEADER The only reason to have a max limit for this is to avoid the risk of a bad server feeding libcurl with a never-ending header that will cause reallocs infinitely
CURL_MAX_WRITE_SIZE Tests have proven that 20K is a very bad buffer size for uploads on Windows, while 16K for some odd reason performed a lot better. We do the ifndef check to allow this value to easier be changed at build time for those who feel adventurous. The practical minimum is about 400 bytes since libcurl uses a buffer of this size as a scratch area (unrelated to network send operations).
CURL_WRITEFUNC_PAUSE This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer.
CURLINFO_DOUBLE
CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE is the new name for the option previously known as CURLINFO_HTTP_CODE
CURLINFO_LONG
CURLINFO_MASK
CURLINFO_SLIST
CURLINFO_STRING
CURLINFO_TYPEMASK
CURLM_CALL_MULTI_SOCKET just to make code nicer when using curl_multi_socket() you can now check for CURLM_CALL_MULTI_SOCKET too in the same style it works for curl_multi_perform() and CURLM_CALL_MULTI_PERFORM
CURLOPT_HEADERDATA three convenient "aliases" that follow the name scheme better
CURLOPT_READDATA three convenient "aliases" that follow the name scheme better
CURLOPT_RTSPHEADER three convenient "aliases" that follow the name scheme better
CURLOPT_SERVER_RESPONSE_TIMEOUT
CURLOPT_WRITEDATA three convenient "aliases" that follow the name scheme better
CURLOPTTYPE_FUNCTIONPOINT long may be 32 or 64 bits, but we should never depend on anything else but 32
CURLOPTTYPE_LONG long may be 32 or 64 bits, but we should never depend on anything else but 32
CURLOPTTYPE_OBJECTPOINT long may be 32 or 64 bits, but we should never depend on anything else but 32
CURLOPTTYPE_OFF_T long may be 32 or 64 bits, but we should never depend on anything else but 32
CURLVERSION_NOW The 'CURLVERSION_NOW' is the symbolic name meant to be used by basically all programs ever that want to get version information. It is meant to be a built-in version number for what kind of struct the caller expects. If the struct ever changes, we redefine the NOW to another enum from above.
HTTPPOST_BUFFER upload file from buffer
HTTPPOST_CALLBACK upload file contents by using the regular read callback to get the data and pass the given pointer as custom pointer
HTTPPOST_FILENAME specified content is a file name
HTTPPOST_PTRBUFFER upload file from pointer contents
HTTPPOST_PTRCONTENTS contents is only stored pointer do not free in formfree
HTTPPOST_PTRNAME name is only stored pointer do not free in formfree
HTTPPOST_READFILE specified content is a file name
LIBCURL_COPYRIGHT This is the global package copyright
LIBCURL_TIMESTAMP This is the date and time when the full source package was created. The timestamp is not stored in git, as the timestamp is properly set in the tarballs by the maketgz script.
LIBCURL_VERSION This is the version number of the libcurl package from which this header file origins:
LIBCURL_VERSION_MAJOR The numeric version number is also available "in parts" by using these constants
LIBCURL_VERSION_MINOR The numeric version number is also available "in parts" by using these constants
LIBCURL_VERSION_NUM This is the numeric version of the libcurl version number, meant for easier parsing and comparions by programs. The LIBCURL_VERSION_NUM define will always follow this syntax:
LIBCURL_VERSION_PATCH The numeric version number is also available "in parts" by using these constants

Aliases

NameTypeDescription
CURL void
curl_calloc_callback void* function(ulong, ulong) The following typedef's are signatures of malloc, free, realloc, strdup and calloc respectively. Function pointers of these types can be passed to the curl_global_init_mem() function to set user defined memory management callback routines.
curl_chunk_bgn_callback long function(const(void)*, void*, int) if splitting of data transfer is enabled, this callback is called before download of an individual chunk started. Note that parameter "remains" works only for FTP wildcard downloading (for now), otherwise is not used
curl_chunk_end_callback long function(void*) If splitting of data transfer is enabled this callback is called after download of an individual chunk finished. Note! After this callback was set then it have to be called FOR ALL chunks. Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. This is the reason why we don't need "transfer_info" parameter in this callback and we are not interested in "remains" parameter too.
curl_closepolicy int
curl_conv_callback int function(char*, ulong) This prototype applies to all conversion callbacks
curl_debug_callback int function(void*, int, char*, ulong, void*)
curl_fnmatch_callback PFPvIPaIQdZi callback type for wildcard downloading pattern matching. If the string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc.
curl_formget_callback PUPvIPamZm callback function for curl_formget() The void *arg pointer will be the one passed as second argument to curl_formget(). The character buffer passed to it must not be freed. Should return the buffer length passed to it as the argument "len" on success.
curl_free_callback void function(void*) The following typedef's are signatures of malloc, free, realloc, strdup and calloc respectively. Function pointers of these types can be passed to the curl_global_init_mem() function to set user defined memory management callback routines.
curl_ftpauth int
curl_ftpccc int
curl_ftpcreatedir int
curl_ftpmethod int
curl_infotype int
curl_ioctl_callback int function(void*, int, void*)
curl_lock_access int
curl_lock_data int
curl_lock_function void function(void*, int, int, void*)
curl_malloc_callback void* function(ulong) The following typedef's are signatures of malloc, free, realloc, strdup and calloc respectively. Function pointers of these types can be passed to the curl_global_init_mem() function to set user defined memory management callback routines.
curl_multi_timer_callback extern(C) int function(void*, long, void*) private callback pointer
curl_off_t long Data type definition of curl_off_t.
curl_opensocket_callback std.socket.socket_t function(void*, int, curl_sockaddr*)
curl_progress_callback int function(void*, double, double, double, double)
curl_proxytype int
curl_read_callback ulong function(char*, ulong, ulong, void*)
curl_realloc_callback void* function(void*, ulong) The following typedef's are signatures of malloc, free, realloc, strdup and calloc respectively. Function pointers of these types can be passed to the curl_global_init_mem() function to set user defined memory management callback routines.
curl_seek_callback int function(void*, long, int)
curl_socket_callback extern(C) int function(void*, std.socket.socket_t, int, void*, void*) private socket pointer
curl_socket_t std.socket.socket_t jdrewsen - Get socket alias from std.socket
CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
curl_sockopt_callback int function(void*, std.socket.socket_t, int)
curl_sshkeycallback int function(void*, const(curl_khkey)*, const(curl_khkey)*, CurlKHMatch, void*)
curl_ssl_ctx_callback int function(void*, void*, void*) actually an OpenSSL SSL_CTX
curl_strdup_callback PFIPaZPa The following typedef's are signatures of malloc, free, realloc, strdup and calloc respectively. Function pointers of these types can be passed to the curl_global_init_mem() function to set user defined memory management callback routines.
curl_TimeCond int
curl_unlock_function void function(void*, int, void*)
curl_usessl int
curl_version_info_data _N28
curl_write_callback ulong function(char*, ulong, ulong, void*)
CURLcode int
curlfiletype int
CURLFORMcode int
CURLINFO int
curliocmd int
curlioerr int
CURLM void
CURLMcode int
CURLMoption int
CURLMSG int
CURLoption int
CURLSH void
CURLSHcode int
CURLSHoption int
curlsocktype int
CURLversion int
fd_set int
FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT name is uppercase CURLOPT_<name>, type is one of the defined CURLOPTTYPE_<type> number is unique identifier
LONG CURLOPTTYPE_LONG name is uppercase CURLOPT_<name>, type is one of the defined CURLOPTTYPE_<type> number is unique identifier
OBJECTPOINT CURLOPTTYPE_OBJECTPOINT name is uppercase CURLOPT_<name>, type is one of the defined CURLOPTTYPE_<type> number is unique identifier
OFF_T CURLOPTTYPE_OFF_T name is uppercase CURLOPT_<name>, type is one of the defined CURLOPTTYPE_<type> number is unique identifier

Authors

License