- CURL_FORMADD_OK on success
- CURL_FORMADD_MEMORY if the FormInfo allocation fails
- CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
- CURL_FORMADD_NULL if a null pointer was given for a char
- CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
- CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
- CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
- CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
- CURL_FORMADD_MEMORY if some allocation for string copying failed.
- CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
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, <daniel@haxx.se>, 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.
Types 124
Data type definition of curl_off_t.
jdrewsen - Always 64bit signed and that is what long is in D.
Comment below is from curlbuild.h:
NOTE 2:
For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit wide signed integral data type. The width of this data type must remain constant and independent of any possible large file support settings.
As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit wide signed integral data type if there is no 64-bit type.
jdrewsen - Get socket alias from std.socket
curl_httppost *next nextchar *name namec_long namelengthchar *contents contentsc_long contentslengthchar *buffer bufferc_long bufferlengthchar *contenttype contenttypecurl_slist *contentheader contentheadercurl_httppost *more morec_long flagschar *showfilename showfilenamevoid *userp userpenumeration of file types
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. If some of these fields is not NULL, it is a pointer to b_data.
char *time timechar *perm permchar *user userchar *group groupchar *target targetContent 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.
char *filename filenamecurlfiletype filetypetime_t timeuint permint uidint gidcurl_off_t sizec_long hardlinks_N2 stringsuint flagschar *b_data b_datasize_t b_sizesize_t b_usedreturn codes for CURLOPT_CHUNK_BGN_FUNCTION
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
return codes for CURLOPT_CHUNK_END_FUNCTION
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.
return codes for FNMATCHFUNCTION
callback type for wildcard downloading pattern matching. If the string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc.
seek whence...
These are the return codes for the seek callbacks
addrlen was a socklen_t type before 7.18.0 but it turned really ugly and painful on the systems that lack this type
int familyint socktypeint protocoluint addrlensockaddr addrThe 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.
ditto
ditto
ditto
ditto
the kind of data that is passed to information_callback
All possible error codes from all sorts of curl functions. Future versions may return other values, stay prepared.
Always add new return codes last. Never EVER remove any. The return codes must remain the same!
This prototype applies to all conversion callbacks
actually an OpenSSL SSL_CTX
points to a zero-terminated string encoded with base64 if len is zero, otherwise to the "raw" data
this is the set of return values expected from the curl_sshkeycallback callback
this is the set of status codes pass in to the callback
parameter for the CURLOPT_USE_SSL option
parameter for the CURLOPT_FTP_SSL_CCC option
parameter for the CURLOPT_FTPSSLAUTH option
parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option
parameter for the CURLOPT_FTP_FILEMETHOD option
CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options
name is uppercase CURLOPT_<name≥, type is one of the defined CURLOPTTYPE_<type≥ number is unique identifier The macro "##" is ISO C, we assume pre-ISO C doesn't support it.
ditto
ditto
ditto
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.
These enums are for use with the CURLOPT_HTTP_VERSION option.
Public API enums for RTSP requests
These enums are for use with the CURLOPT_NETRC option.
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
structure to be used as parameter for CURLFORM_ARRAY
Use this for multipart formpost building
Returns code for curl_formadd()
Returns
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.
linked-list structure for the CURLOPT_QUOTE option (and other)
char *data datacurl_slist *next nextinfo about the certificate chain, only for OpenSSL builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO
int num_of_certscurl_slist * *certinfo certinfoSetup defines, protos etc for the sharing stuff. Different data locks for a single share
Different lock access types
pass in a user data pointer used in the lock/unlock callback functions
Structures for querying information about the curl library at runtime.
CURLversion ageconst(char) *version_ version_uint version_numconst(char) *host hostint featuresconst(char) *ssl_version ssl_versionc_long ssl_version_numconst(char) *libz_version libz_versionconst(char) * *protocols protocolsprotocols is terminated by an entry with a NULL protonameconst(char) *ares aresThe fields below this were added in CURLVERSION_SECONDint ares_numconst(char) *libidn libidnThis field was added in CURLVERSION_THIRDint iconv_ver_numThese field were added in CURLVERSIONFOURTH. Same as 'libiconvversion' if built with HAVEICONVconst(char) *libssh_version libssh_versionName: curl_multi_fdset()
Desc: Ask curl for its fd_set sets. The app can use these to select() or poll() on. We want curl_multi_perform() called as soon as one of them are ready.
Returns
tmp decl
Name: curl_multi_socket() and curl_multi_socket_all()
Desc: An alternative version of curl_multi_perform() that allows the application to pass in one of the file descriptors that have been detected to have "action" on them and let libcurl perform. See man page for details.
private socket pointer
Name: curl_multi_timer_callback
Desc: Called by libcurl whenever the library detects a change in the maximum number of milliseconds the app is allowed to wait before curl_multi_socket() or curl_multi_perform() must be called (to allow libcurl's timed events to take place).
Returns
private callback pointer
Functions 48
int curl_strequal(scope const(char) * s1, scope const(char) * s2)curlstrequal() and curlstrnequal() are subject for removal in a future libcurl, see lib/README.curlx for detailsCURLFORMcode curl_formadd(curl_httppost * * httppost, curl_httppost * * last_post,...)Name: curl_formadd()int curl_formget(curl_httppost * form, void * arg, curl_formget_callback append)Name: curl_formget()char * curl_easy_escape(CURL * handle, scope const(char) * string, int length)Name: curleasyescape()char * curl_easy_unescape(CURL * handle, scope const(char) * string, int length, int * outlength)Name: curleasyunescape()CURLcode curl_global_init_mem(
c_long flags,
curl_malloc_callback m,
curl_free_callback f,
curl_realloc_callback r,
curl_strdup_callback s,
curl_calloc_callback c
)Name: curlglobalinit_mem()CURLSH * curl_share_init()CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option,...)CURL * curl_easy_init()CURLcode curl_easy_setopt(CURL * curl, CURLoption option,...)CURLcode curl_easy_perform(CURL * curl)void curl_easy_cleanup(CURL * curl)CURLcode curl_easy_recv(CURL * curl, void * buffer, size_t buflen, size_t * n)Name: curleasyrecv()CURLcode curl_easy_send(CURL * curl, void * buffer, size_t buflen, size_t * n)Name: curleasysend()CURLMcode curl_multi_add_handle(CURLM * multi_handle, CURL * curl_handle)Name: curlmultiadd_handle()CURLMcode curl_multi_remove_handle(CURLM * multi_handle, CURL * curl_handle)Name: curlmultiremove_handle()CURLMcode curl_multi_fdset(
CURLM * multi_handle,
fd_set * read_fd_set,
fd_set * write_fd_set,
fd_set * exc_fd_set,
int * max_fd
)CURLMsg * curl_multi_info_read(CURLM * multi_handle, int * msgs_in_queue)Name: curlmultiinfo_read()CURLMcode curl_multi_socket_action(CURLM * multi_handle, curl_socket_t s, int ev_bitmask, int * running_handles)dittoCURLMcode curl_multi_timeout(CURLM * multi_handle, c_long * milliseconds)This macro below was added in 7.16.3 to push users who recompile to use the new curlmultisocketaction() instead of the old curlmultisocket() Name: curlmulti_timeout()CURLMcode curl_multi_assign(CURLM * multi_handle, curl_socket_t sockfd, void * sockp)Name: curlmultiassign()Variables 36
LIBCURL_COPYRIGHT = "1996 - 2010 Daniel Stenberg, <daniel@haxx.se>."This is the global package copyright
LIBCURL_VERSION = "7.21.4"This is the version number of the libcurl package from which this header file origins:
LIBCURL_VERSION_MAJOR = 7The numeric version number is also available "in parts" by using these constants
LIBCURL_VERSION_MINOR = 21ditto
LIBCURL_VERSION_PATCH = 4ditto
LIBCURL_VERSION_NUM = 0x071504This 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:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in hexadecimal (using 8 bits each). All three numbers are always represented using two digits. 1.2 would appear as "0x010200" while version 9.11.7 appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number, and it is always a greater number in a more recent release. It makes comparisons with greater than and less than work.
LIBCURL_TIMESTAMP = "Thu Feb 17 12:19:40 UTC 2011"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.
The format of the date should follow this template:
"Mon Feb 12 11:35:33 UTC 2007"
HTTPPOST_FILENAME = 1specified content is a file name
HTTPPOST_READFILE = 2specified content is a file name
HTTPPOST_PTRNAME = 4name is only stored pointer do not free in formfree
HTTPPOST_PTRCONTENTS = 8contents is only stored pointer do not free in formfree
HTTPPOST_BUFFER = 16upload file from buffer
HTTPPOST_PTRBUFFER = 32upload file from pointer contents
HTTPPOST_CALLBACK = 64upload file contents by using the regular read callback to get the data and pass the given pointer as custom pointer
CURL_MAX_WRITE_SIZE = 16_384Tests 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_MAX_HTTP_HEADER = (100 * 1024)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_WRITEFUNC_PAUSE = 0x10000001This is a magic return code for the write callback that, when returned, will signal libcurl to pause receiving on the current transfer.
CURL_ERROR_SIZE = 256CURLOPTTYPE_LONG = 0long may be 32 or 64 bits, but we should never depend on anything else but 32
CURLOPTTYPE_OBJECTPOINT = 10_000ditto
CURLOPTTYPE_FUNCTIONPOINT = 20_000ditto
CURLOPTTYPE_OFF_T = 30_000ditto
CURLOPT_SERVER_RESPONSE_TIMEOUT = CurlOption.ftp_response_timeoutCURLOPT_WRITEDATA = CurlOption.filethree convenient "aliases" that follow the name scheme better
CURLOPT_READDATA = CurlOption.infileditto
CURLOPT_HEADERDATA = CurlOption.writeheaderditto
CURLOPT_RTSPHEADER = CurlOption.httpheaderditto
CURLINFO_STRING = 0x100000CURLINFO_LONG = 0x200000CURLINFO_DOUBLE = 0x300000CURLINFO_SLIST = 0x400000CURLINFO_MASK = 0x0fffffCURLINFO_TYPEMASK = 0xf00000CURLINFO_HTTP_CODE = CurlInfo.response_codeCURLINFO_RESPONSE_CODE is the new name for the option previously known as CURLINFO_HTTP_CODE
CURLVERSION_NOW = CurlVer.fourthThe '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.
CURLM_CALL_MULTI_SOCKET = CurlM.call_multi_performjust 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