3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
26 * If you have libcurl problems, all docs and details are found here:
27 * http://curl.haxx.se/libcurl/
29 * curl-library mailing list subscription and unsubscription web interface:
30 * http://cool.haxx.se/mailman/listinfo/curl-library/
33 #include "curlver.h" /* libcurl version defines */
34 #include "curlbuild.h" /* libcurl build definitions */
35 #include "curlrules.h" /* libcurl rules enforcement */
38 * Define WIN32 when build target is Win32 API
41 #if (defined(_WIN32) || defined(__WIN32__)) && \
42 !defined(WIN32) && !defined(__SYMBIAN32__)
49 #if defined(__FreeBSD__) && (__FreeBSD__ >= 2)
50 /* Needed for __FreeBSD_version symbol definition */
51 #include <osreldate.h>
54 /* The include stuff here below is mainly for time_t! */
55 #include <sys/types.h>
58 #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__CYGWIN__)
59 #if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H) || defined(__LWIP_OPT_H__))
60 /* The check above prevents the winsock2 inclusion if winsock.h already was
61 included, since they can't co-exist without problems */
67 /* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
68 libc5-based Linux systems. Only include it on systems that are known to
70 #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
71 defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
72 defined(ANDROID) || defined(__ANDROID__) || \
73 (defined(__FreeBSD_version) && (__FreeBSD_version < 800000))
74 #include <sys/select.h>
77 #if !defined(WIN32) && !defined(_WIN32_WCE)
78 #include <sys/socket.h>
81 #if !defined(WIN32) && !defined(__WATCOMC__) && !defined(__VXWORKS__)
86 #include <support/SupportDefs.h>
96 * libcurl external API function linkage decorations.
101 #elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
102 # if defined(BUILDING_LIBCURL)
103 # define CURL_EXTERN __declspec(dllexport)
105 # define CURL_EXTERN __declspec(dllimport)
107 #elif defined(BUILDING_LIBCURL) && defined(CURL_HIDDEN_SYMBOLS)
108 # define CURL_EXTERN CURL_EXTERN_SYMBOL
113 #ifndef curl_socket_typedef
115 #if defined(WIN32) && !defined(__LWIP_OPT_H__)
116 typedef SOCKET curl_socket_t;
117 #define CURL_SOCKET_BAD INVALID_SOCKET
119 typedef int curl_socket_t;
120 #define CURL_SOCKET_BAD -1
122 #define curl_socket_typedef
123 #endif /* curl_socket_typedef */
125 struct curl_httppost {
126 struct curl_httppost *next; /* next entry in the list */
127 char *name; /* pointer to allocated name */
128 long namelength; /* length of name length */
129 char *contents; /* pointer to allocated data contents */
130 long contentslength; /* length of contents field */
131 char *buffer; /* pointer to allocated buffer contents */
132 long bufferlength; /* length of buffer field */
133 char *contenttype; /* Content-Type */
134 struct curl_slist* contentheader; /* list of extra headers for this form */
135 struct curl_httppost *more; /* if one field name has more than one
136 file, this link should link to following
138 long flags; /* as defined below */
139 #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
140 #define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
141 #define HTTPPOST_PTRNAME (1<<2) /* name is only stored pointer
142 do not free in formfree */
143 #define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
144 do not free in formfree */
145 #define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
146 #define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
147 #define HTTPPOST_CALLBACK (1<<6) /* upload file contents by using the
148 regular read callback to get the data
149 and pass the given pointer as custom
152 char *showfilename; /* The file name to show. If not set, the
153 actual file name will be used (if this
155 void *userp; /* custom pointer used for
156 HTTPPOST_CALLBACK posts */
159 /* This is the CURLOPT_PROGRESSFUNCTION callback proto. It is now considered
160 deprecated but was the only choice up until 7.31.0 */
161 typedef int (*curl_progress_callback)(void *clientp,
167 /* This is the CURLOPT_XFERINFOFUNCTION callback proto. It was introduced in
168 7.32.0, it avoids floating point and provides more detailed information. */
169 typedef int (*curl_xferinfo_callback)(void *clientp,
175 #ifndef CURL_MAX_WRITE_SIZE
176 /* Tests have proven that 20K is a very bad buffer size for uploads on
177 Windows, while 16K for some odd reason performed a lot better.
178 We do the ifndef check to allow this value to easier be changed at build
179 time for those who feel adventurous. The practical minimum is about
180 400 bytes since libcurl uses a buffer of this size as a scratch area
181 (unrelated to network send operations). */
182 #define CURL_MAX_WRITE_SIZE 16384
185 #ifndef CURL_MAX_HTTP_HEADER
186 /* The only reason to have a max limit for this is to avoid the risk of a bad
187 server feeding libcurl with a never-ending header that will cause reallocs
189 #define CURL_MAX_HTTP_HEADER (100*1024)
192 /* This is a magic return code for the write callback that, when returned,
193 will signal libcurl to pause receiving on the current transfer. */
194 #define CURL_WRITEFUNC_PAUSE 0x10000001
196 typedef size_t (*curl_write_callback)(char *buffer,
203 /* enumeration of file types */
205 CURLFILETYPE_FILE = 0,
206 CURLFILETYPE_DIRECTORY,
207 CURLFILETYPE_SYMLINK,
208 CURLFILETYPE_DEVICE_BLOCK,
209 CURLFILETYPE_DEVICE_CHAR,
210 CURLFILETYPE_NAMEDPIPE,
212 CURLFILETYPE_DOOR, /* is possible only on Sun Solaris now */
214 CURLFILETYPE_UNKNOWN /* should never occur */
217 #define CURLFINFOFLAG_KNOWN_FILENAME (1<<0)
218 #define CURLFINFOFLAG_KNOWN_FILETYPE (1<<1)
219 #define CURLFINFOFLAG_KNOWN_TIME (1<<2)
220 #define CURLFINFOFLAG_KNOWN_PERM (1<<3)
221 #define CURLFINFOFLAG_KNOWN_UID (1<<4)
222 #define CURLFINFOFLAG_KNOWN_GID (1<<5)
223 #define CURLFINFOFLAG_KNOWN_SIZE (1<<6)
224 #define CURLFINFOFLAG_KNOWN_HLINKCOUNT (1<<7)
226 /* Content of this structure depends on information which is known and is
227 achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
228 page for callbacks returning this structure -- some fields are mandatory,
229 some others are optional. The FLAG field has special meaning. */
230 struct curl_fileinfo {
232 curlfiletype filetype;
241 /* If some of these fields is not NULL, it is a pointer to b_data. */
246 char *target; /* pointer to the target filename of a symlink */
251 /* used internally */
257 /* return codes for CURLOPT_CHUNK_BGN_FUNCTION */
258 #define CURL_CHUNK_BGN_FUNC_OK 0
259 #define CURL_CHUNK_BGN_FUNC_FAIL 1 /* tell the lib to end the task */
260 #define CURL_CHUNK_BGN_FUNC_SKIP 2 /* skip this chunk over */
262 /* if splitting of data transfer is enabled, this callback is called before
263 download of an individual chunk started. Note that parameter "remains" works
264 only for FTP wildcard downloading (for now), otherwise is not used */
265 typedef long (*curl_chunk_bgn_callback)(const void *transfer_info,
269 /* return codes for CURLOPT_CHUNK_END_FUNCTION */
270 #define CURL_CHUNK_END_FUNC_OK 0
271 #define CURL_CHUNK_END_FUNC_FAIL 1 /* tell the lib to end the task */
273 /* If splitting of data transfer is enabled this callback is called after
274 download of an individual chunk finished.
275 Note! After this callback was set then it have to be called FOR ALL chunks.
276 Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
277 This is the reason why we don't need "transfer_info" parameter in this
278 callback and we are not interested in "remains" parameter too. */
279 typedef long (*curl_chunk_end_callback)(void *ptr);
281 /* return codes for FNMATCHFUNCTION */
282 #define CURL_FNMATCHFUNC_MATCH 0 /* string corresponds to the pattern */
283 #define CURL_FNMATCHFUNC_NOMATCH 1 /* pattern doesn't match the string */
284 #define CURL_FNMATCHFUNC_FAIL 2 /* an error occurred */
286 /* callback type for wildcard downloading pattern matching. If the
287 string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
288 typedef int (*curl_fnmatch_callback)(void *ptr,
292 /* These are the return codes for the seek callbacks */
293 #define CURL_SEEKFUNC_OK 0
294 #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
295 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
296 libcurl might try other means instead */
297 typedef int (*curl_seek_callback)(void *instream,
299 int origin); /* 'whence' */
301 /* This is a return code for the read callback that, when returned, will
302 signal libcurl to immediately abort the current transfer. */
303 #define CURL_READFUNC_ABORT 0x10000000
304 /* This is a return code for the read callback that, when returned, will
305 signal libcurl to pause sending data on the current transfer. */
306 #define CURL_READFUNC_PAUSE 0x10000001
308 typedef size_t (*curl_read_callback)(char *buffer,
314 CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
315 CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
316 CURLSOCKTYPE_LAST /* never use */
319 /* The return code from the sockopt_callback can signal information back
321 #define CURL_SOCKOPT_OK 0
322 #define CURL_SOCKOPT_ERROR 1 /* causes libcurl to abort and return
323 CURLE_ABORTED_BY_CALLBACK */
324 #define CURL_SOCKOPT_ALREADY_CONNECTED 2
326 typedef int (*curl_sockopt_callback)(void *clientp,
327 curl_socket_t curlfd,
328 curlsocktype purpose);
330 struct curl_sockaddr {
334 unsigned int addrlen; /* addrlen was a socklen_t type before 7.18.0 but it
335 turned really ugly and painful on the systems that
337 struct sockaddr addr;
340 typedef curl_socket_t
341 (*curl_opensocket_callback)(void *clientp,
342 curlsocktype purpose,
343 struct curl_sockaddr *address);
346 (*curl_closesocket_callback)(void *clientp, curl_socket_t item);
349 CURLIOE_OK, /* I/O operation successful */
350 CURLIOE_UNKNOWNCMD, /* command was unknown to callback */
351 CURLIOE_FAILRESTART, /* failed to restart the read */
352 CURLIOE_LAST /* never use */
356 CURLIOCMD_NOP, /* no operation */
357 CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
358 CURLIOCMD_LAST /* never use */
361 typedef curlioerr (*curl_ioctl_callback)(CURL *handle,
366 * The following typedef's are signatures of malloc, free, realloc, strdup and
367 * calloc respectively. Function pointers of these types can be passed to the
368 * curl_global_init_mem() function to set user defined memory management
371 typedef void *(*curl_malloc_callback)(size_t size);
372 typedef void (*curl_free_callback)(void *ptr);
373 typedef void *(*curl_realloc_callback)(void *ptr, size_t size);
374 typedef char *(*curl_strdup_callback)(const char *str);
375 typedef void *(*curl_calloc_callback)(size_t nmemb, size_t size);
377 /* the kind of data that is passed to information_callback*/
380 CURLINFO_HEADER_IN, /* 1 */
381 CURLINFO_HEADER_OUT, /* 2 */
382 CURLINFO_DATA_IN, /* 3 */
383 CURLINFO_DATA_OUT, /* 4 */
384 CURLINFO_SSL_DATA_IN, /* 5 */
385 CURLINFO_SSL_DATA_OUT, /* 6 */
389 typedef int (*curl_debug_callback)
390 (CURL *handle, /* the handle/transfer this concerns */
391 curl_infotype type, /* what kind of data */
392 char *data, /* points to the data */
393 size_t size, /* size of the data pointed to */
394 void *userptr); /* whatever the user please */
396 /* All possible error codes from all sorts of curl functions. Future versions
397 may return other values, stay prepared.
399 Always add new return codes last. Never *EVER* remove any. The return
400 codes must remain the same!
405 CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
406 CURLE_FAILED_INIT, /* 2 */
407 CURLE_URL_MALFORMAT, /* 3 */
408 CURLE_NOT_BUILT_IN, /* 4 - [was obsoleted in August 2007 for
409 7.17.0, reused in April 2011 for 7.21.5] */
410 CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
411 CURLE_COULDNT_RESOLVE_HOST, /* 6 */
412 CURLE_COULDNT_CONNECT, /* 7 */
413 CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
414 CURLE_REMOTE_ACCESS_DENIED, /* 9 a service was denied by the server
415 due to lack of access - when login fails
416 this is not returned. */
417 CURLE_FTP_ACCEPT_FAILED, /* 10 - [was obsoleted in April 2006 for
418 7.15.4, reused in Dec 2011 for 7.24.0]*/
419 CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
420 CURLE_FTP_ACCEPT_TIMEOUT, /* 12 - timeout occurred accepting server
421 [was obsoleted in August 2007 for 7.17.0,
422 reused in Dec 2011 for 7.24.0]*/
423 CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
424 CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
425 CURLE_FTP_CANT_GET_HOST, /* 15 */
426 CURLE_OBSOLETE16, /* 16 - NOT USED */
427 CURLE_FTP_COULDNT_SET_TYPE, /* 17 */
428 CURLE_PARTIAL_FILE, /* 18 */
429 CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
430 CURLE_OBSOLETE20, /* 20 - NOT USED */
431 CURLE_QUOTE_ERROR, /* 21 - quote command failure */
432 CURLE_HTTP_RETURNED_ERROR, /* 22 */
433 CURLE_WRITE_ERROR, /* 23 */
434 CURLE_OBSOLETE24, /* 24 - NOT USED */
435 CURLE_UPLOAD_FAILED, /* 25 - failed upload "command" */
436 CURLE_READ_ERROR, /* 26 - couldn't open/read from file */
437 CURLE_OUT_OF_MEMORY, /* 27 */
438 /* Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
439 instead of a memory allocation error if CURL_DOES_CONVERSIONS
442 CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was reached */
443 CURLE_OBSOLETE29, /* 29 - NOT USED */
444 CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
445 CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
446 CURLE_OBSOLETE32, /* 32 - NOT USED */
447 CURLE_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
448 CURLE_HTTP_POST_ERROR, /* 34 */
449 CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
450 CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
451 CURLE_FILE_COULDNT_READ_FILE, /* 37 */
452 CURLE_LDAP_CANNOT_BIND, /* 38 */
453 CURLE_LDAP_SEARCH_FAILED, /* 39 */
454 CURLE_OBSOLETE40, /* 40 - NOT USED */
455 CURLE_FUNCTION_NOT_FOUND, /* 41 */
456 CURLE_ABORTED_BY_CALLBACK, /* 42 */
457 CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
458 CURLE_OBSOLETE44, /* 44 - NOT USED */
459 CURLE_INTERFACE_FAILED, /* 45 - CURLOPT_INTERFACE failed */
460 CURLE_OBSOLETE46, /* 46 - NOT USED */
461 CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
462 CURLE_UNKNOWN_OPTION, /* 48 - User specified an unknown option */
463 CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
464 CURLE_OBSOLETE50, /* 50 - NOT USED */
465 CURLE_PEER_FAILED_VERIFICATION, /* 51 - peer's certificate or fingerprint
466 wasn't verified fine */
467 CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
468 CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
469 CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
471 CURLE_SEND_ERROR, /* 55 - failed sending network data */
472 CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
473 CURLE_OBSOLETE57, /* 57 - NOT IN USE */
474 CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
475 CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
476 CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
477 CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
478 CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
479 CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
480 CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
481 CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
483 CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
484 CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
485 accepted and we failed to login */
486 CURLE_TFTP_NOTFOUND, /* 68 - file not found on server */
487 CURLE_TFTP_PERM, /* 69 - permission problem on server */
488 CURLE_REMOTE_DISK_FULL, /* 70 - out of disk space on server */
489 CURLE_TFTP_ILLEGAL, /* 71 - Illegal TFTP operation */
490 CURLE_TFTP_UNKNOWNID, /* 72 - Unknown transfer ID */
491 CURLE_REMOTE_FILE_EXISTS, /* 73 - File already exists */
492 CURLE_TFTP_NOSUCHUSER, /* 74 - No such user */
493 CURLE_CONV_FAILED, /* 75 - conversion failed */
494 CURLE_CONV_REQD, /* 76 - caller must register conversion
495 callbacks using curl_easy_setopt options
496 CURLOPT_CONV_FROM_NETWORK_FUNCTION,
497 CURLOPT_CONV_TO_NETWORK_FUNCTION, and
498 CURLOPT_CONV_FROM_UTF8_FUNCTION */
499 CURLE_SSL_CACERT_BADFILE, /* 77 - could not load CACERT file, missing
501 CURLE_REMOTE_FILE_NOT_FOUND, /* 78 - remote file not found */
502 CURLE_SSH, /* 79 - error from the SSH layer, somewhat
503 generic so the error message will be of
504 interest when this has happened */
506 CURLE_SSL_SHUTDOWN_FAILED, /* 80 - Failed to shut down the SSL
508 CURLE_AGAIN, /* 81 - socket is not ready for send/recv,
509 wait till it's ready and try again (Added
511 CURLE_SSL_CRL_BADFILE, /* 82 - could not load CRL file, missing or
512 wrong format (Added in 7.19.0) */
513 CURLE_SSL_ISSUER_ERROR, /* 83 - Issuer check failed. (Added in
515 CURLE_FTP_PRET_FAILED, /* 84 - a PRET command failed */
516 CURLE_RTSP_CSEQ_ERROR, /* 85 - mismatch of RTSP CSeq numbers */
517 CURLE_RTSP_SESSION_ERROR, /* 86 - mismatch of RTSP Session Ids */
518 CURLE_FTP_BAD_FILE_LIST, /* 87 - unable to parse FTP file list */
519 CURLE_CHUNK_FAILED, /* 88 - chunk callback reported error */
520 CURLE_NO_CONNECTION_AVAILABLE, /* 89 - No connection available, the
521 session will be queued */
522 CURL_LAST /* never use! */
525 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
526 the obsolete stuff removed! */
528 /* Previously obsoletes error codes re-used in 7.24.0 */
529 #define CURLE_OBSOLETE10 CURLE_FTP_ACCEPT_FAILED
530 #define CURLE_OBSOLETE12 CURLE_FTP_ACCEPT_TIMEOUT
532 /* compatibility with older names */
533 #define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
535 /* The following were added in 7.21.5, April 2011 */
536 #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
538 /* The following were added in 7.17.1 */
539 /* These are scheduled to disappear by 2009 */
540 #define CURLE_SSL_PEER_CERTIFICATE CURLE_PEER_FAILED_VERIFICATION
542 /* The following were added in 7.17.0 */
543 /* These are scheduled to disappear by 2009 */
544 #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
545 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
546 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
547 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
548 #define CURLE_FTP_CANT_RECONNECT CURLE_OBSOLETE16
549 #define CURLE_FTP_COULDNT_GET_SIZE CURLE_OBSOLETE32
550 #define CURLE_FTP_COULDNT_SET_ASCII CURLE_OBSOLETE29
551 #define CURLE_FTP_WEIRD_USER_REPLY CURLE_OBSOLETE12
552 #define CURLE_FTP_WRITE_ERROR CURLE_OBSOLETE20
553 #define CURLE_LIBRARY_NOT_FOUND CURLE_OBSOLETE40
554 #define CURLE_MALFORMAT_USER CURLE_OBSOLETE24
555 #define CURLE_SHARE_IN_USE CURLE_OBSOLETE57
556 #define CURLE_URL_MALFORMAT_USER CURLE_NOT_BUILT_IN
558 #define CURLE_FTP_ACCESS_DENIED CURLE_REMOTE_ACCESS_DENIED
559 #define CURLE_FTP_COULDNT_SET_BINARY CURLE_FTP_COULDNT_SET_TYPE
560 #define CURLE_FTP_QUOTE_ERROR CURLE_QUOTE_ERROR
561 #define CURLE_TFTP_DISKFULL CURLE_REMOTE_DISK_FULL
562 #define CURLE_TFTP_EXISTS CURLE_REMOTE_FILE_EXISTS
563 #define CURLE_HTTP_RANGE_ERROR CURLE_RANGE_ERROR
564 #define CURLE_FTP_SSL_FAILED CURLE_USE_SSL_FAILED
566 /* The following were added earlier */
568 #define CURLE_OPERATION_TIMEOUTED CURLE_OPERATION_TIMEDOUT
570 #define CURLE_HTTP_NOT_FOUND CURLE_HTTP_RETURNED_ERROR
571 #define CURLE_HTTP_PORT_FAILED CURLE_INTERFACE_FAILED
572 #define CURLE_FTP_COULDNT_STOR_FILE CURLE_UPLOAD_FAILED
574 #define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
575 #define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
577 /* This was the error code 50 in 7.7.3 and a few earlier versions, this
578 is no longer used by libcurl but is instead #defined here only to not
579 make programs break */
580 #define CURLE_ALREADY_COMPLETE 99999
582 #endif /*!CURL_NO_OLDIES*/
584 /* This prototype applies to all conversion callbacks */
585 typedef CURLcode (*curl_conv_callback)(char *buffer, size_t length);
587 typedef CURLcode (*curl_ssl_ctx_callback)(CURL *curl, /* easy handle */
588 void *ssl_ctx, /* actually an
593 CURLPROXY_HTTP = 0, /* added in 7.10, new in 7.19.4 default is to use
595 CURLPROXY_HTTP_1_0 = 1, /* added in 7.19.4, force to use CONNECT
597 CURLPROXY_SOCKS4 = 4, /* support added in 7.15.2, enum existed already
599 CURLPROXY_SOCKS5 = 5, /* added in 7.10 */
600 CURLPROXY_SOCKS4A = 6, /* added in 7.18.0 */
601 CURLPROXY_SOCKS5_HOSTNAME = 7 /* Use the SOCKS5 protocol but pass along the
602 host name rather than the IP address. added
604 } curl_proxytype; /* this enum was added in 7.10 */
607 * Bitmasks for CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH options:
609 * CURLAUTH_NONE - No HTTP authentication
610 * CURLAUTH_BASIC - HTTP Basic authentication (default)
611 * CURLAUTH_DIGEST - HTTP Digest authentication
612 * CURLAUTH_GSSNEGOTIATE - HTTP GSS-Negotiate authentication
613 * CURLAUTH_NTLM - HTTP NTLM authentication
614 * CURLAUTH_DIGEST_IE - HTTP Digest authentication with IE flavour
615 * CURLAUTH_NTLM_WB - HTTP NTLM authentication delegated to winbind helper
616 * CURLAUTH_ONLY - Use together with a single other type to force no
617 * authentication or just that single type
618 * CURLAUTH_ANY - All fine types set
619 * CURLAUTH_ANYSAFE - All fine types except Basic
622 #define CURLAUTH_NONE ((unsigned long)0)
623 #define CURLAUTH_BASIC (((unsigned long)1)<<0)
624 #define CURLAUTH_DIGEST (((unsigned long)1)<<1)
625 #define CURLAUTH_GSSNEGOTIATE (((unsigned long)1)<<2)
626 #define CURLAUTH_NTLM (((unsigned long)1)<<3)
627 #define CURLAUTH_DIGEST_IE (((unsigned long)1)<<4)
628 #define CURLAUTH_NTLM_WB (((unsigned long)1)<<5)
629 #define CURLAUTH_ONLY (((unsigned long)1)<<31)
630 #define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE)
631 #define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
633 #define CURLSSH_AUTH_ANY ~0 /* all types supported by the server */
634 #define CURLSSH_AUTH_NONE 0 /* none allowed, silly but complete */
635 #define CURLSSH_AUTH_PUBLICKEY (1<<0) /* public/private key files */
636 #define CURLSSH_AUTH_PASSWORD (1<<1) /* password */
637 #define CURLSSH_AUTH_HOST (1<<2) /* host key files */
638 #define CURLSSH_AUTH_KEYBOARD (1<<3) /* keyboard interactive */
639 #define CURLSSH_AUTH_AGENT (1<<4) /* agent (ssh-agent, pageant...) */
640 #define CURLSSH_AUTH_DEFAULT CURLSSH_AUTH_ANY
642 #define CURLGSSAPI_DELEGATION_NONE 0 /* no delegation (default) */
643 #define CURLGSSAPI_DELEGATION_POLICY_FLAG (1<<0) /* if permitted by policy */
644 #define CURLGSSAPI_DELEGATION_FLAG (1<<1) /* delegate always */
646 #define CURL_ERROR_SIZE 256
656 const char *key; /* points to a zero-terminated string encoded with base64
657 if len is zero, otherwise to the "raw" data */
659 enum curl_khtype keytype;
662 /* this is the set of return values expected from the curl_sshkeycallback
665 CURLKHSTAT_FINE_ADD_TO_FILE,
667 CURLKHSTAT_REJECT, /* reject the connection, return an error */
668 CURLKHSTAT_DEFER, /* do not accept it, but we can't answer right now so
669 this causes a CURLE_DEFER error but otherwise the
670 connection will be left intact etc */
671 CURLKHSTAT_LAST /* not for use, only a marker for last-in-list */
674 /* this is the set of status codes pass in to the callback */
676 CURLKHMATCH_OK, /* match */
677 CURLKHMATCH_MISMATCH, /* host found, key mismatch! */
678 CURLKHMATCH_MISSING, /* no matching host/key found */
679 CURLKHMATCH_LAST /* not for use, only a marker for last-in-list */
683 (*curl_sshkeycallback) (CURL *easy, /* easy handle */
684 const struct curl_khkey *knownkey, /* known */
685 const struct curl_khkey *foundkey, /* found */
686 enum curl_khmatch, /* libcurl's view on the keys */
687 void *clientp); /* custom pointer passed from app */
689 /* parameter for the CURLOPT_USE_SSL option */
691 CURLUSESSL_NONE, /* do not attempt to use SSL */
692 CURLUSESSL_TRY, /* try using SSL, proceed anyway otherwise */
693 CURLUSESSL_CONTROL, /* SSL for the control connection or fail */
694 CURLUSESSL_ALL, /* SSL for all communication or fail */
695 CURLUSESSL_LAST /* not an option, never use */
698 /* Definition of bits for the CURLOPT_SSL_OPTIONS argument: */
700 /* - ALLOW_BEAST tells libcurl to allow the BEAST SSL vulnerability in the
701 name of improving interoperability with older servers. Some SSL libraries
702 have introduced work-arounds for this flaw but those work-arounds sometimes
703 make the SSL communication fail. To regain functionality with those broken
704 servers, a user can this way allow the vulnerability back. */
705 #define CURLSSLOPT_ALLOW_BEAST (1<<0)
707 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
708 the obsolete stuff removed! */
710 /* Backwards compatibility with older names */
711 /* These are scheduled to disappear by 2009 */
713 #define CURLFTPSSL_NONE CURLUSESSL_NONE
714 #define CURLFTPSSL_TRY CURLUSESSL_TRY
715 #define CURLFTPSSL_CONTROL CURLUSESSL_CONTROL
716 #define CURLFTPSSL_ALL CURLUSESSL_ALL
717 #define CURLFTPSSL_LAST CURLUSESSL_LAST
718 #define curl_ftpssl curl_usessl
719 #endif /*!CURL_NO_OLDIES*/
721 /* parameter for the CURLOPT_FTP_SSL_CCC option */
723 CURLFTPSSL_CCC_NONE, /* do not send CCC */
724 CURLFTPSSL_CCC_PASSIVE, /* Let the server initiate the shutdown */
725 CURLFTPSSL_CCC_ACTIVE, /* Initiate the shutdown */
726 CURLFTPSSL_CCC_LAST /* not an option, never use */
729 /* parameter for the CURLOPT_FTPSSLAUTH option */
731 CURLFTPAUTH_DEFAULT, /* let libcurl decide */
732 CURLFTPAUTH_SSL, /* use "AUTH SSL" */
733 CURLFTPAUTH_TLS, /* use "AUTH TLS" */
734 CURLFTPAUTH_LAST /* not an option, never use */
737 /* parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
739 CURLFTP_CREATE_DIR_NONE, /* do NOT create missing dirs! */
740 CURLFTP_CREATE_DIR, /* (FTP/SFTP) if CWD fails, try MKD and then CWD
741 again if MKD succeeded, for SFTP this does
743 CURLFTP_CREATE_DIR_RETRY, /* (FTP only) if CWD fails, try MKD and then CWD
744 again even if MKD failed! */
745 CURLFTP_CREATE_DIR_LAST /* not an option, never use */
748 /* parameter for the CURLOPT_FTP_FILEMETHOD option */
750 CURLFTPMETHOD_DEFAULT, /* let libcurl pick */
751 CURLFTPMETHOD_MULTICWD, /* single CWD operation for each path part */
752 CURLFTPMETHOD_NOCWD, /* no CWD at all */
753 CURLFTPMETHOD_SINGLECWD, /* one CWD to full dir, then work on file */
754 CURLFTPMETHOD_LAST /* not an option, never use */
757 /* CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
758 #define CURLPROTO_HTTP (1<<0)
759 #define CURLPROTO_HTTPS (1<<1)
760 #define CURLPROTO_FTP (1<<2)
761 #define CURLPROTO_FTPS (1<<3)
762 #define CURLPROTO_SCP (1<<4)
763 #define CURLPROTO_SFTP (1<<5)
764 #define CURLPROTO_TELNET (1<<6)
765 #define CURLPROTO_LDAP (1<<7)
766 #define CURLPROTO_LDAPS (1<<8)
767 #define CURLPROTO_DICT (1<<9)
768 #define CURLPROTO_FILE (1<<10)
769 #define CURLPROTO_TFTP (1<<11)
770 #define CURLPROTO_IMAP (1<<12)
771 #define CURLPROTO_IMAPS (1<<13)
772 #define CURLPROTO_POP3 (1<<14)
773 #define CURLPROTO_POP3S (1<<15)
774 #define CURLPROTO_SMTP (1<<16)
775 #define CURLPROTO_SMTPS (1<<17)
776 #define CURLPROTO_RTSP (1<<18)
777 #define CURLPROTO_RTMP (1<<19)
778 #define CURLPROTO_RTMPT (1<<20)
779 #define CURLPROTO_RTMPE (1<<21)
780 #define CURLPROTO_RTMPTE (1<<22)
781 #define CURLPROTO_RTMPS (1<<23)
782 #define CURLPROTO_RTMPTS (1<<24)
783 #define CURLPROTO_GOPHER (1<<25)
784 #define CURLPROTO_ALL (~0) /* enable everything */
786 /* long may be 32 or 64 bits, but we should never depend on anything else
788 #define CURLOPTTYPE_LONG 0
789 #define CURLOPTTYPE_OBJECTPOINT 10000
790 #define CURLOPTTYPE_FUNCTIONPOINT 20000
791 #define CURLOPTTYPE_OFF_T 30000
793 /* name is uppercase CURLOPT_<name>,
794 type is one of the defined CURLOPTTYPE_<type>
795 number is unique identifier */
801 #define CINIT(na,t,nu) CURLOPT_ ## na = CURLOPTTYPE_ ## t + nu
803 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
804 #define LONG CURLOPTTYPE_LONG
805 #define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
806 #define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
807 #define OFF_T CURLOPTTYPE_OFF_T
808 #define CINIT(name,type,number) CURLOPT_/**/name = type + number
812 * This macro-mania below setups the CURLOPT_[what] enum, to be used with
813 * curl_easy_setopt(). The first argument in the CINIT() macro is the [what]
818 /* This is the FILE * or void * the regular output should be written to. */
819 CINIT(FILE, OBJECTPOINT, 1),
821 /* The full URL to get/put */
822 CINIT(URL, OBJECTPOINT, 2),
824 /* Port number to connect to, if other than default. */
825 CINIT(PORT, LONG, 3),
827 /* Name of proxy to use. */
828 CINIT(PROXY, OBJECTPOINT, 4),
830 /* "name:password" to use when fetching. */
831 CINIT(USERPWD, OBJECTPOINT, 5),
833 /* "name:password" to use with proxy. */
834 CINIT(PROXYUSERPWD, OBJECTPOINT, 6),
836 /* Range to get, specified as an ASCII string. */
837 CINIT(RANGE, OBJECTPOINT, 7),
841 /* Specified file stream to upload from (use as input): */
842 CINIT(INFILE, OBJECTPOINT, 9),
844 /* Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
845 * bytes big. If this is not used, error messages go to stderr instead: */
846 CINIT(ERRORBUFFER, OBJECTPOINT, 10),
848 /* Function that will be called to store the output (instead of fwrite). The
849 * parameters will use fwrite() syntax, make sure to follow them. */
850 CINIT(WRITEFUNCTION, FUNCTIONPOINT, 11),
852 /* Function that will be called to read the input (instead of fread). The
853 * parameters will use fread() syntax, make sure to follow them. */
854 CINIT(READFUNCTION, FUNCTIONPOINT, 12),
856 /* Time-out the read operation after this amount of seconds */
857 CINIT(TIMEOUT, LONG, 13),
859 /* If the CURLOPT_INFILE is used, this can be used to inform libcurl about
860 * how large the file being sent really is. That allows better error
861 * checking and better verifies that the upload was successful. -1 means
864 * For large file support, there is also a _LARGE version of the key
865 * which takes an off_t type, allowing platforms with larger off_t
866 * sizes to handle larger files. See below for INFILESIZE_LARGE.
868 CINIT(INFILESIZE, LONG, 14),
870 /* POST static input fields. */
871 CINIT(POSTFIELDS, OBJECTPOINT, 15),
873 /* Set the referrer page (needed by some CGIs) */
874 CINIT(REFERER, OBJECTPOINT, 16),
876 /* Set the FTP PORT string (interface name, named or numerical IP address)
877 Use i.e '-' to use default address. */
878 CINIT(FTPPORT, OBJECTPOINT, 17),
880 /* Set the User-Agent string (examined by some CGIs) */
881 CINIT(USERAGENT, OBJECTPOINT, 18),
883 /* If the download receives less than "low speed limit" bytes/second
884 * during "low speed time" seconds, the operations is aborted.
885 * You could i.e if you have a pretty high speed connection, abort if
886 * it is less than 2000 bytes/sec during 20 seconds.
889 /* Set the "low speed limit" */
890 CINIT(LOW_SPEED_LIMIT, LONG, 19),
892 /* Set the "low speed time" */
893 CINIT(LOW_SPEED_TIME, LONG, 20),
895 /* Set the continuation offset.
897 * Note there is also a _LARGE version of this key which uses
898 * off_t types, allowing for large file offsets on platforms which
899 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
901 CINIT(RESUME_FROM, LONG, 21),
903 /* Set cookie in request: */
904 CINIT(COOKIE, OBJECTPOINT, 22),
906 /* This points to a linked list of headers, struct curl_slist kind */
907 CINIT(HTTPHEADER, OBJECTPOINT, 23),
909 /* This points to a linked list of post entries, struct curl_httppost */
910 CINIT(HTTPPOST, OBJECTPOINT, 24),
912 /* name of the file keeping your private SSL-certificate */
913 CINIT(SSLCERT, OBJECTPOINT, 25),
915 /* password for the SSL or SSH private key */
916 CINIT(KEYPASSWD, OBJECTPOINT, 26),
918 /* send TYPE parameter? */
919 CINIT(CRLF, LONG, 27),
921 /* send linked-list of QUOTE commands */
922 CINIT(QUOTE, OBJECTPOINT, 28),
924 /* send FILE * or void * to store headers to, if you use a callback it
925 is simply passed to the callback unmodified */
926 CINIT(WRITEHEADER, OBJECTPOINT, 29),
928 /* point to a file to read the initial cookies from, also enables
929 "cookie awareness" */
930 CINIT(COOKIEFILE, OBJECTPOINT, 31),
932 /* What version to specifically try to use.
933 See CURL_SSLVERSION defines below. */
934 CINIT(SSLVERSION, LONG, 32),
936 /* What kind of HTTP time condition to use, see defines */
937 CINIT(TIMECONDITION, LONG, 33),
939 /* Time to use with the above condition. Specified in number of seconds
941 CINIT(TIMEVALUE, LONG, 34),
945 /* Custom request, for customizing the get command like
946 HTTP: DELETE, TRACE and others
947 FTP: to use a different list command
949 CINIT(CUSTOMREQUEST, OBJECTPOINT, 36),
951 /* HTTP request, for odd commands like DELETE, TRACE and others */
952 CINIT(STDERR, OBJECTPOINT, 37),
956 /* send linked-list of post-transfer QUOTE commands */
957 CINIT(POSTQUOTE, OBJECTPOINT, 39),
959 CINIT(WRITEINFO, OBJECTPOINT, 40), /* DEPRECATED, do not use! */
961 CINIT(VERBOSE, LONG, 41), /* talk a lot */
962 CINIT(HEADER, LONG, 42), /* throw the header out too */
963 CINIT(NOPROGRESS, LONG, 43), /* shut off the progress meter */
964 CINIT(NOBODY, LONG, 44), /* use HEAD to get http document */
965 CINIT(FAILONERROR, LONG, 45), /* no output on http error codes >= 300 */
966 CINIT(UPLOAD, LONG, 46), /* this is an upload */
967 CINIT(POST, LONG, 47), /* HTTP POST method */
968 CINIT(DIRLISTONLY, LONG, 48), /* bare names when listing directories */
970 CINIT(APPEND, LONG, 50), /* Append instead of overwrite on upload! */
972 /* Specify whether to read the user+password from the .netrc or the URL.
973 * This must be one of the CURL_NETRC_* enums below. */
974 CINIT(NETRC, LONG, 51),
976 CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
978 CINIT(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
979 CINIT(PUT, LONG, 54), /* HTTP PUT */
984 * Function that will be called instead of the internal progress display
985 * function. This function should be defined as the curl_progress_callback
986 * prototype defines. */
987 CINIT(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
989 /* Data passed to the CURLOPT_PROGRESSFUNCTION and CURLOPT_XFERINFOFUNCTION
991 CINIT(PROGRESSDATA, OBJECTPOINT, 57),
992 #define CURLOPT_XFERINFODATA CURLOPT_PROGRESSDATA
994 /* We want the referrer field set automatically when following locations */
995 CINIT(AUTOREFERER, LONG, 58),
997 /* Port of the proxy, can be set in the proxy string as well with:
999 CINIT(PROXYPORT, LONG, 59),
1001 /* size of the POST input data, if strlen() is not good to use */
1002 CINIT(POSTFIELDSIZE, LONG, 60),
1004 /* tunnel non-http operations through a HTTP proxy */
1005 CINIT(HTTPPROXYTUNNEL, LONG, 61),
1007 /* Set the interface string to use as outgoing network interface */
1008 CINIT(INTERFACE, OBJECTPOINT, 62),
1010 /* Set the krb4/5 security level, this also enables krb4/5 awareness. This
1011 * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
1012 * is set but doesn't match one of these, 'private' will be used. */
1013 CINIT(KRBLEVEL, OBJECTPOINT, 63),
1015 /* Set if we should verify the peer in ssl handshake, set 1 to verify. */
1016 CINIT(SSL_VERIFYPEER, LONG, 64),
1018 /* The CApath or CAfile used to validate the peer certificate
1019 this option is used only if SSL_VERIFYPEER is true */
1020 CINIT(CAINFO, OBJECTPOINT, 65),
1025 /* Maximum number of http redirects to follow */
1026 CINIT(MAXREDIRS, LONG, 68),
1028 /* Pass a long set to 1 to get the date of the requested document (if
1029 possible)! Pass a zero to shut it off. */
1030 CINIT(FILETIME, LONG, 69),
1032 /* This points to a linked list of telnet options */
1033 CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
1035 /* Max amount of cached alive connections */
1036 CINIT(MAXCONNECTS, LONG, 71),
1038 CINIT(CLOSEPOLICY, LONG, 72), /* DEPRECATED, do not use! */
1042 /* Set to explicitly use a new connection for the upcoming transfer.
1043 Do not use this unless you're absolutely sure of this, as it makes the
1044 operation slower and is less friendly for the network. */
1045 CINIT(FRESH_CONNECT, LONG, 74),
1047 /* Set to explicitly forbid the upcoming transfer's connection to be re-used
1048 when done. Do not use this unless you're absolutely sure of this, as it
1049 makes the operation slower and is less friendly for the network. */
1050 CINIT(FORBID_REUSE, LONG, 75),
1052 /* Set to a file name that contains random data for libcurl to use to
1053 seed the random engine when doing SSL connects. */
1054 CINIT(RANDOM_FILE, OBJECTPOINT, 76),
1056 /* Set to the Entropy Gathering Daemon socket pathname */
1057 CINIT(EGDSOCKET, OBJECTPOINT, 77),
1059 /* Time-out connect operations after this amount of seconds, if connects are
1060 OK within this time, then fine... This only aborts the connect phase. */
1061 CINIT(CONNECTTIMEOUT, LONG, 78),
1063 /* Function that will be called to store headers (instead of fwrite). The
1064 * parameters will use fwrite() syntax, make sure to follow them. */
1065 CINIT(HEADERFUNCTION, FUNCTIONPOINT, 79),
1067 /* Set this to force the HTTP request to get back to GET. Only really usable
1068 if POST, PUT or a custom request have been used first.
1070 CINIT(HTTPGET, LONG, 80),
1072 /* Set if we should verify the Common name from the peer certificate in ssl
1073 * handshake, set 1 to check existence, 2 to ensure that it matches the
1074 * provided hostname. */
1075 CINIT(SSL_VERIFYHOST, LONG, 81),
1077 /* Specify which file name to write all known cookies in after completed
1078 operation. Set file name to "-" (dash) to make it go to stdout. */
1079 CINIT(COOKIEJAR, OBJECTPOINT, 82),
1081 /* Specify which SSL ciphers to use */
1082 CINIT(SSL_CIPHER_LIST, OBJECTPOINT, 83),
1084 /* Specify which HTTP version to use! This must be set to one of the
1085 CURL_HTTP_VERSION* enums set below. */
1086 CINIT(HTTP_VERSION, LONG, 84),
1088 /* Specifically switch on or off the FTP engine's use of the EPSV command. By
1089 default, that one will always be attempted before the more traditional
1091 CINIT(FTP_USE_EPSV, LONG, 85),
1093 /* type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
1094 CINIT(SSLCERTTYPE, OBJECTPOINT, 86),
1096 /* name of the file keeping your private SSL-key */
1097 CINIT(SSLKEY, OBJECTPOINT, 87),
1099 /* type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
1100 CINIT(SSLKEYTYPE, OBJECTPOINT, 88),
1102 /* crypto engine for the SSL-sub system */
1103 CINIT(SSLENGINE, OBJECTPOINT, 89),
1105 /* set the crypto engine for the SSL-sub system as default
1106 the param has no meaning...
1108 CINIT(SSLENGINE_DEFAULT, LONG, 90),
1110 /* Non-zero value means to use the global dns cache */
1111 CINIT(DNS_USE_GLOBAL_CACHE, LONG, 91), /* DEPRECATED, do not use! */
1113 /* DNS cache timeout */
1114 CINIT(DNS_CACHE_TIMEOUT, LONG, 92),
1116 /* send linked-list of pre-transfer QUOTE commands */
1117 CINIT(PREQUOTE, OBJECTPOINT, 93),
1119 /* set the debug function */
1120 CINIT(DEBUGFUNCTION, FUNCTIONPOINT, 94),
1122 /* set the data for the debug function */
1123 CINIT(DEBUGDATA, OBJECTPOINT, 95),
1125 /* mark this as start of a cookie session */
1126 CINIT(COOKIESESSION, LONG, 96),
1128 /* The CApath directory used to validate the peer certificate
1129 this option is used only if SSL_VERIFYPEER is true */
1130 CINIT(CAPATH, OBJECTPOINT, 97),
1132 /* Instruct libcurl to use a smaller receive buffer */
1133 CINIT(BUFFERSIZE, LONG, 98),
1135 /* Instruct libcurl to not use any signal/alarm handlers, even when using
1136 timeouts. This option is useful for multi-threaded applications.
1137 See libcurl-the-guide for more background information. */
1138 CINIT(NOSIGNAL, LONG, 99),
1140 /* Provide a CURLShare for mutexing non-ts data */
1141 CINIT(SHARE, OBJECTPOINT, 100),
1143 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
1144 CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
1145 CINIT(PROXYTYPE, LONG, 101),
1147 /* Set the Accept-Encoding string. Use this to tell a server you would like
1148 the response to be compressed. Before 7.21.6, this was known as
1150 CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
1152 /* Set pointer to private data */
1153 CINIT(PRIVATE, OBJECTPOINT, 103),
1155 /* Set aliases for HTTP 200 in the HTTP Response header */
1156 CINIT(HTTP200ALIASES, OBJECTPOINT, 104),
1158 /* Continue to send authentication (user+password) when following locations,
1159 even when hostname changed. This can potentially send off the name
1160 and password to whatever host the server decides. */
1161 CINIT(UNRESTRICTED_AUTH, LONG, 105),
1163 /* Specifically switch on or off the FTP engine's use of the EPRT command (
1164 it also disables the LPRT attempt). By default, those ones will always be
1165 attempted before the good old traditional PORT command. */
1166 CINIT(FTP_USE_EPRT, LONG, 106),
1168 /* Set this to a bitmask value to enable the particular authentications
1169 methods you like. Use this in combination with CURLOPT_USERPWD.
1170 Note that setting multiple bits may cause extra network round-trips. */
1171 CINIT(HTTPAUTH, LONG, 107),
1173 /* Set the ssl context callback function, currently only for OpenSSL ssl_ctx
1174 in second argument. The function must be matching the
1175 curl_ssl_ctx_callback proto. */
1176 CINIT(SSL_CTX_FUNCTION, FUNCTIONPOINT, 108),
1178 /* Set the userdata for the ssl context callback function's third
1180 CINIT(SSL_CTX_DATA, OBJECTPOINT, 109),
1182 /* FTP Option that causes missing dirs to be created on the remote server.
1183 In 7.19.4 we introduced the convenience enums for this option using the
1184 CURLFTP_CREATE_DIR prefix.
1186 CINIT(FTP_CREATE_MISSING_DIRS, LONG, 110),
1188 /* Set this to a bitmask value to enable the particular authentications
1189 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD.
1190 Note that setting multiple bits may cause extra network round-trips. */
1191 CINIT(PROXYAUTH, LONG, 111),
1193 /* FTP option that changes the timeout, in seconds, associated with
1194 getting a response. This is different from transfer timeout time and
1195 essentially places a demand on the FTP server to acknowledge commands
1196 in a timely manner. */
1197 CINIT(FTP_RESPONSE_TIMEOUT, LONG, 112),
1198 #define CURLOPT_SERVER_RESPONSE_TIMEOUT CURLOPT_FTP_RESPONSE_TIMEOUT
1200 /* Set this option to one of the CURL_IPRESOLVE_* defines (see below) to
1201 tell libcurl to resolve names to those IP versions only. This only has
1202 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */
1203 CINIT(IPRESOLVE, LONG, 113),
1205 /* Set this option to limit the size of a file that will be downloaded from
1206 an HTTP or FTP server.
1208 Note there is also _LARGE version which adds large file support for
1209 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */
1210 CINIT(MAXFILESIZE, LONG, 114),
1212 /* See the comment for INFILESIZE above, but in short, specifies
1213 * the size of the file being uploaded. -1 means unknown.
1215 CINIT(INFILESIZE_LARGE, OFF_T, 115),
1217 /* Sets the continuation offset. There is also a LONG version of this;
1218 * look above for RESUME_FROM.
1220 CINIT(RESUME_FROM_LARGE, OFF_T, 116),
1222 /* Sets the maximum size of data that will be downloaded from
1223 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version.
1225 CINIT(MAXFILESIZE_LARGE, OFF_T, 117),
1227 /* Set this option to the file name of your .netrc file you want libcurl
1228 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do
1229 a poor attempt to find the user's home directory and check for a .netrc
1231 CINIT(NETRC_FILE, OBJECTPOINT, 118),
1233 /* Enable SSL/TLS for FTP, pick one of:
1234 CURLUSESSL_TRY - try using SSL, proceed anyway otherwise
1235 CURLUSESSL_CONTROL - SSL for the control connection or fail
1236 CURLUSESSL_ALL - SSL for all communication or fail
1238 CINIT(USE_SSL, LONG, 119),
1240 /* The _LARGE version of the standard POSTFIELDSIZE option */
1241 CINIT(POSTFIELDSIZE_LARGE, OFF_T, 120),
1243 /* Enable/disable the TCP Nagle algorithm */
1244 CINIT(TCP_NODELAY, LONG, 121),
1246 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1247 /* 123 OBSOLETE. Gone in 7.16.0 */
1248 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1249 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1250 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */
1251 /* 127 OBSOLETE. Gone in 7.16.0 */
1252 /* 128 OBSOLETE. Gone in 7.16.0 */
1254 /* When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option
1255 can be used to change libcurl's default action which is to first try
1256 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK
1257 response has been received.
1259 Available parameters are:
1260 CURLFTPAUTH_DEFAULT - let libcurl decide
1261 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS
1262 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL
1264 CINIT(FTPSSLAUTH, LONG, 129),
1266 CINIT(IOCTLFUNCTION, FUNCTIONPOINT, 130),
1267 CINIT(IOCTLDATA, OBJECTPOINT, 131),
1269 /* 132 OBSOLETE. Gone in 7.16.0 */
1270 /* 133 OBSOLETE. Gone in 7.16.0 */
1272 /* zero terminated string for pass on to the FTP server when asked for
1274 CINIT(FTP_ACCOUNT, OBJECTPOINT, 134),
1276 /* feed cookies into cookie engine */
1277 CINIT(COOKIELIST, OBJECTPOINT, 135),
1279 /* ignore Content-Length */
1280 CINIT(IGNORE_CONTENT_LENGTH, LONG, 136),
1282 /* Set to non-zero to skip the IP address received in a 227 PASV FTP server
1283 response. Typically used for FTP-SSL purposes but is not restricted to
1284 that. libcurl will then instead use the same IP address it used for the
1285 control connection. */
1286 CINIT(FTP_SKIP_PASV_IP, LONG, 137),
1288 /* Select "file method" to use when doing FTP, see the curl_ftpmethod
1290 CINIT(FTP_FILEMETHOD, LONG, 138),
1292 /* Local port number to bind the socket to */
1293 CINIT(LOCALPORT, LONG, 139),
1295 /* Number of ports to try, including the first one set with LOCALPORT.
1296 Thus, setting it to 1 will make no additional attempts but the first.
1298 CINIT(LOCALPORTRANGE, LONG, 140),
1300 /* no transfer, set up connection and let application use the socket by
1301 extracting it with CURLINFO_LASTSOCKET */
1302 CINIT(CONNECT_ONLY, LONG, 141),
1304 /* Function that will be called to convert from the
1305 network encoding (instead of using the iconv calls in libcurl) */
1306 CINIT(CONV_FROM_NETWORK_FUNCTION, FUNCTIONPOINT, 142),
1308 /* Function that will be called to convert to the
1309 network encoding (instead of using the iconv calls in libcurl) */
1310 CINIT(CONV_TO_NETWORK_FUNCTION, FUNCTIONPOINT, 143),
1312 /* Function that will be called to convert from UTF8
1313 (instead of using the iconv calls in libcurl)
1314 Note that this is used only for SSL certificate processing */
1315 CINIT(CONV_FROM_UTF8_FUNCTION, FUNCTIONPOINT, 144),
1317 /* if the connection proceeds too quickly then need to slow it down */
1318 /* limit-rate: maximum number of bytes per second to send or receive */
1319 CINIT(MAX_SEND_SPEED_LARGE, OFF_T, 145),
1320 CINIT(MAX_RECV_SPEED_LARGE, OFF_T, 146),
1322 /* Pointer to command string to send if USER/PASS fails. */
1323 CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147),
1325 /* callback function for setting socket options */
1326 CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148),
1327 CINIT(SOCKOPTDATA, OBJECTPOINT, 149),
1329 /* set to 0 to disable session ID re-use for this transfer, default is
1331 CINIT(SSL_SESSIONID_CACHE, LONG, 150),
1333 /* allowed SSH authentication methods */
1334 CINIT(SSH_AUTH_TYPES, LONG, 151),
1336 /* Used by scp/sftp to do public/private key authentication */
1337 CINIT(SSH_PUBLIC_KEYFILE, OBJECTPOINT, 152),
1338 CINIT(SSH_PRIVATE_KEYFILE, OBJECTPOINT, 153),
1340 /* Send CCC (Clear Command Channel) after authentication */
1341 CINIT(FTP_SSL_CCC, LONG, 154),
1343 /* Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */
1344 CINIT(TIMEOUT_MS, LONG, 155),
1345 CINIT(CONNECTTIMEOUT_MS, LONG, 156),
1347 /* set to zero to disable the libcurl's decoding and thus pass the raw body
1348 data to the application even when it is encoded/compressed */
1349 CINIT(HTTP_TRANSFER_DECODING, LONG, 157),
1350 CINIT(HTTP_CONTENT_DECODING, LONG, 158),
1352 /* Permission used when creating new files and directories on the remote
1353 server for protocols that support it, SFTP/SCP/FILE */
1354 CINIT(NEW_FILE_PERMS, LONG, 159),
1355 CINIT(NEW_DIRECTORY_PERMS, LONG, 160),
1357 /* Set the behaviour of POST when redirecting. Values must be set to one
1358 of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */
1359 CINIT(POSTREDIR, LONG, 161),
1361 /* used by scp/sftp to verify the host's public key */
1362 CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
1364 /* Callback function for opening socket (instead of socket(2)). Optionally,
1365 callback is able change the address or refuse to connect returning
1366 CURL_SOCKET_BAD. The callback should have type
1367 curl_opensocket_callback */
1368 CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
1369 CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
1371 /* POST volatile input fields. */
1372 CINIT(COPYPOSTFIELDS, OBJECTPOINT, 165),
1374 /* set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy */
1375 CINIT(PROXY_TRANSFER_MODE, LONG, 166),
1377 /* Callback function for seeking in the input stream */
1378 CINIT(SEEKFUNCTION, FUNCTIONPOINT, 167),
1379 CINIT(SEEKDATA, OBJECTPOINT, 168),
1382 CINIT(CRLFILE, OBJECTPOINT, 169),
1384 /* Issuer certificate */
1385 CINIT(ISSUERCERT, OBJECTPOINT, 170),
1387 /* (IPv6) Address scope */
1388 CINIT(ADDRESS_SCOPE, LONG, 171),
1390 /* Collect certificate chain info and allow it to get retrievable with
1391 CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only
1392 working with OpenSSL-powered builds. */
1393 CINIT(CERTINFO, LONG, 172),
1395 /* "name" and "pwd" to use when fetching. */
1396 CINIT(USERNAME, OBJECTPOINT, 173),
1397 CINIT(PASSWORD, OBJECTPOINT, 174),
1399 /* "name" and "pwd" to use with Proxy when fetching. */
1400 CINIT(PROXYUSERNAME, OBJECTPOINT, 175),
1401 CINIT(PROXYPASSWORD, OBJECTPOINT, 176),
1403 /* Comma separated list of hostnames defining no-proxy zones. These should
1404 match both hostnames directly, and hostnames within a domain. For
1405 example, local.com will match local.com and www.local.com, but NOT
1406 notlocal.com or www.notlocal.com. For compatibility with other
1407 implementations of this, .local.com will be considered to be the same as
1408 local.com. A single * is the only valid wildcard, and effectively
1409 disables the use of proxy. */
1410 CINIT(NOPROXY, OBJECTPOINT, 177),
1412 /* block size for TFTP transfers */
1413 CINIT(TFTP_BLKSIZE, LONG, 178),
1416 CINIT(SOCKS5_GSSAPI_SERVICE, OBJECTPOINT, 179),
1419 CINIT(SOCKS5_GSSAPI_NEC, LONG, 180),
1421 /* set the bitmask for the protocols that are allowed to be used for the
1422 transfer, which thus helps the app which takes URLs from users or other
1423 external inputs and want to restrict what protocol(s) to deal
1424 with. Defaults to CURLPROTO_ALL. */
1425 CINIT(PROTOCOLS, LONG, 181),
1427 /* set the bitmask for the protocols that libcurl is allowed to follow to,
1428 as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs
1429 to be set in both bitmasks to be allowed to get redirected to. Defaults
1430 to all protocols except FILE and SCP. */
1431 CINIT(REDIR_PROTOCOLS, LONG, 182),
1433 /* set the SSH knownhost file name to use */
1434 CINIT(SSH_KNOWNHOSTS, OBJECTPOINT, 183),
1436 /* set the SSH host key callback, must point to a curl_sshkeycallback
1438 CINIT(SSH_KEYFUNCTION, FUNCTIONPOINT, 184),
1440 /* set the SSH host key callback custom pointer */
1441 CINIT(SSH_KEYDATA, OBJECTPOINT, 185),
1443 /* set the SMTP mail originator */
1444 CINIT(MAIL_FROM, OBJECTPOINT, 186),
1446 /* set the SMTP mail receiver(s) */
1447 CINIT(MAIL_RCPT, OBJECTPOINT, 187),
1449 /* FTP: send PRET before PASV */
1450 CINIT(FTP_USE_PRET, LONG, 188),
1452 /* RTSP request method (OPTIONS, SETUP, PLAY, etc...) */
1453 CINIT(RTSP_REQUEST, LONG, 189),
1455 /* The RTSP session identifier */
1456 CINIT(RTSP_SESSION_ID, OBJECTPOINT, 190),
1458 /* The RTSP stream URI */
1459 CINIT(RTSP_STREAM_URI, OBJECTPOINT, 191),
1461 /* The Transport: header to use in RTSP requests */
1462 CINIT(RTSP_TRANSPORT, OBJECTPOINT, 192),
1464 /* Manually initialize the client RTSP CSeq for this handle */
1465 CINIT(RTSP_CLIENT_CSEQ, LONG, 193),
1467 /* Manually initialize the server RTSP CSeq for this handle */
1468 CINIT(RTSP_SERVER_CSEQ, LONG, 194),
1470 /* The stream to pass to INTERLEAVEFUNCTION. */
1471 CINIT(INTERLEAVEDATA, OBJECTPOINT, 195),
1473 /* Let the application define a custom write method for RTP data */
1474 CINIT(INTERLEAVEFUNCTION, FUNCTIONPOINT, 196),
1476 /* Turn on wildcard matching */
1477 CINIT(WILDCARDMATCH, LONG, 197),
1479 /* Directory matching callback called before downloading of an
1480 individual file (chunk) started */
1481 CINIT(CHUNK_BGN_FUNCTION, FUNCTIONPOINT, 198),
1483 /* Directory matching callback called after the file (chunk)
1484 was downloaded, or skipped */
1485 CINIT(CHUNK_END_FUNCTION, FUNCTIONPOINT, 199),
1487 /* Change match (fnmatch-like) callback for wildcard matching */
1488 CINIT(FNMATCH_FUNCTION, FUNCTIONPOINT, 200),
1490 /* Let the application define custom chunk data pointer */
1491 CINIT(CHUNK_DATA, OBJECTPOINT, 201),
1493 /* FNMATCH_FUNCTION user pointer */
1494 CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
1496 /* send linked-list of name:port:address sets */
1497 CINIT(RESOLVE, OBJECTPOINT, 203),
1499 /* Set a username for authenticated TLS */
1500 CINIT(TLSAUTH_USERNAME, OBJECTPOINT, 204),
1502 /* Set a password for authenticated TLS */
1503 CINIT(TLSAUTH_PASSWORD, OBJECTPOINT, 205),
1505 /* Set authentication type for authenticated TLS */
1506 CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
1508 /* Set to 1 to enable the "TE:" header in HTTP requests to ask for
1509 compressed transfer-encoded responses. Set to 0 to disable the use of TE:
1510 in outgoing requests. The current default is 0, but it might change in a
1511 future libcurl release.
1513 libcurl will ask for the compressed methods it knows of, and if that
1514 isn't any, it will not ask for transfer-encoding at all even if this
1518 CINIT(TRANSFER_ENCODING, LONG, 207),
1520 /* Callback function for closing socket (instead of close(2)). The callback
1521 should have type curl_closesocket_callback */
1522 CINIT(CLOSESOCKETFUNCTION, FUNCTIONPOINT, 208),
1523 CINIT(CLOSESOCKETDATA, OBJECTPOINT, 209),
1525 /* allow GSSAPI credential delegation */
1526 CINIT(GSSAPI_DELEGATION, LONG, 210),
1528 /* Set the name servers to use for DNS resolution */
1529 CINIT(DNS_SERVERS, OBJECTPOINT, 211),
1531 /* Time-out accept operations (currently for FTP only) after this amount
1533 CINIT(ACCEPTTIMEOUT_MS, LONG, 212),
1535 /* Set TCP keepalive */
1536 CINIT(TCP_KEEPALIVE, LONG, 213),
1538 /* non-universal keepalive knobs (Linux, AIX, HP-UX, more) */
1539 CINIT(TCP_KEEPIDLE, LONG, 214),
1540 CINIT(TCP_KEEPINTVL, LONG, 215),
1542 /* Enable/disable specific SSL features with a bitmask, see CURLSSLOPT_* */
1543 CINIT(SSL_OPTIONS, LONG, 216),
1545 /* Set the SMTP auth originator */
1546 CINIT(MAIL_AUTH, OBJECTPOINT, 217),
1548 /* Enable/disable SASL initial response */
1549 CINIT(SASL_IR, LONG, 218),
1551 /* Function that will be called instead of the internal progress display
1552 * function. This function should be defined as the curl_xferinfo_callback
1553 * prototype defines. (Deprecates CURLOPT_PROGRESSFUNCTION) */
1554 CINIT(XFERINFOFUNCTION, FUNCTIONPOINT, 219),
1556 /* The XOAUTH2 bearer token */
1557 CINIT(XOAUTH2_BEARER, OBJECTPOINT, 220),
1559 /* Set the interface string to use as outgoing network
1560 * interface for DNS requests.
1561 * Only supported by the c-ares DNS backend */
1562 CINIT(DNS_INTERFACE, OBJECTPOINT, 221),
1564 /* Set the local IPv4 address to use for outgoing DNS requests.
1565 * Only supported by the c-ares DNS backend */
1566 CINIT(DNS_LOCAL_IP4, OBJECTPOINT, 222),
1568 /* Set the local IPv4 address to use for outgoing DNS requests.
1569 * Only supported by the c-ares DNS backend */
1570 CINIT(DNS_LOCAL_IP6, OBJECTPOINT, 223),
1572 CURLOPT_LASTENTRY /* the last unused */
1575 #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
1576 the obsolete stuff removed! */
1578 /* Backwards compatibility with older names */
1579 /* These are scheduled to disappear by 2011 */
1581 /* This was added in version 7.19.1 */
1582 #define CURLOPT_POST301 CURLOPT_POSTREDIR
1584 /* These are scheduled to disappear by 2009 */
1586 /* The following were added in 7.17.0 */
1587 #define CURLOPT_SSLKEYPASSWD CURLOPT_KEYPASSWD
1588 #define CURLOPT_FTPAPPEND CURLOPT_APPEND
1589 #define CURLOPT_FTPLISTONLY CURLOPT_DIRLISTONLY
1590 #define CURLOPT_FTP_SSL CURLOPT_USE_SSL
1592 /* The following were added earlier */
1594 #define CURLOPT_SSLCERTPASSWD CURLOPT_KEYPASSWD
1595 #define CURLOPT_KRB4LEVEL CURLOPT_KRBLEVEL
1598 /* This is set if CURL_NO_OLDIES is defined at compile-time */
1599 #undef CURLOPT_DNS_USE_GLOBAL_CACHE /* soon obsolete */
1603 /* Below here follows defines for the CURLOPT_IPRESOLVE option. If a host
1604 name resolves addresses using more than one IP protocol version, this
1605 option might be handy to force libcurl to use a specific IP version. */
1606 #define CURL_IPRESOLVE_WHATEVER 0 /* default, resolves addresses to all IP
1607 versions that your system allows */
1608 #define CURL_IPRESOLVE_V4 1 /* resolve to ipv4 addresses */
1609 #define CURL_IPRESOLVE_V6 2 /* resolve to ipv6 addresses */
1611 /* three convenient "aliases" that follow the name scheme better */
1612 #define CURLOPT_WRITEDATA CURLOPT_FILE
1613 #define CURLOPT_READDATA CURLOPT_INFILE
1614 #define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
1615 #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER
1617 /* These enums are for use with the CURLOPT_HTTP_VERSION option. */
1619 CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
1620 like the library to choose the best possible
1622 CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */
1623 CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */
1624 CURL_HTTP_VERSION_2_0, /* please use HTTP 2.0 in the request */
1626 CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
1630 * Public API enums for RTSP requests
1633 CURL_RTSPREQ_NONE, /* first in list */
1634 CURL_RTSPREQ_OPTIONS,
1635 CURL_RTSPREQ_DESCRIBE,
1636 CURL_RTSPREQ_ANNOUNCE,
1640 CURL_RTSPREQ_TEARDOWN,
1641 CURL_RTSPREQ_GET_PARAMETER,
1642 CURL_RTSPREQ_SET_PARAMETER,
1643 CURL_RTSPREQ_RECORD,
1644 CURL_RTSPREQ_RECEIVE,
1645 CURL_RTSPREQ_LAST /* last in list */
1648 /* These enums are for use with the CURLOPT_NETRC option. */
1649 enum CURL_NETRC_OPTION {
1650 CURL_NETRC_IGNORED, /* The .netrc will never be read.
1651 * This is the default. */
1652 CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
1653 * to one in the .netrc. */
1654 CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
1655 * Unless one is set programmatically, the .netrc
1656 * will be queried. */
1661 CURL_SSLVERSION_DEFAULT,
1662 CURL_SSLVERSION_TLSv1, /* TLS 1.x */
1663 CURL_SSLVERSION_SSLv2,
1664 CURL_SSLVERSION_SSLv3,
1665 CURL_SSLVERSION_TLSv1_0,
1666 CURL_SSLVERSION_TLSv1_1,
1667 CURL_SSLVERSION_TLSv1_2,
1669 CURL_SSLVERSION_LAST /* never use, keep last */
1675 CURL_TLSAUTH_LAST /* never use, keep last */
1678 /* symbols to use with CURLOPT_POSTREDIR.
1679 CURL_REDIR_POST_301, CURL_REDIR_POST_302 and CURL_REDIR_POST_303
1680 can be bitwise ORed so that CURL_REDIR_POST_301 | CURL_REDIR_POST_302
1681 | CURL_REDIR_POST_303 == CURL_REDIR_POST_ALL */
1683 #define CURL_REDIR_GET_ALL 0
1684 #define CURL_REDIR_POST_301 1
1685 #define CURL_REDIR_POST_302 2
1686 #define CURL_REDIR_POST_303 4
1687 #define CURL_REDIR_POST_ALL \
1688 (CURL_REDIR_POST_301|CURL_REDIR_POST_302|CURL_REDIR_POST_303)
1693 CURL_TIMECOND_IFMODSINCE,
1694 CURL_TIMECOND_IFUNMODSINCE,
1695 CURL_TIMECOND_LASTMOD,
1701 /* curl_strequal() and curl_strnequal() are subject for removal in a future
1702 libcurl, see lib/README.curlx for details */
1703 CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
1704 CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
1706 /* name is uppercase CURLFORM_<name> */
1712 #define CFINIT(name) CURLFORM_ ## name
1714 /* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
1715 #define CFINIT(name) CURLFORM_/**/name
1719 CFINIT(NOTHING), /********* the first one is unused ************/
1725 CFINIT(COPYCONTENTS),
1726 CFINIT(PTRCONTENTS),
1727 CFINIT(CONTENTSLENGTH),
1728 CFINIT(FILECONTENT),
1735 CFINIT(BUFFERLENGTH),
1737 CFINIT(CONTENTTYPE),
1738 CFINIT(CONTENTHEADER),
1745 CURLFORM_LASTENTRY /* the last unused */
1748 #undef CFINIT /* done */
1750 /* structure to be used as parameter for CURLFORM_ARRAY */
1752 CURLformoption option;
1756 /* use this for multipart formpost building */
1757 /* Returns code for curl_formadd()
1760 * CURL_FORMADD_OK on success
1761 * CURL_FORMADD_MEMORY if the FormInfo allocation fails
1762 * CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
1763 * CURL_FORMADD_NULL if a null pointer was given for a char
1764 * CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
1765 * CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
1766 * CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
1767 * CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated
1768 * CURL_FORMADD_MEMORY if some allocation for string copying failed.
1769 * CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
1771 ***************************************************************************/
1773 CURL_FORMADD_OK, /* first, no error */
1775 CURL_FORMADD_MEMORY,
1776 CURL_FORMADD_OPTION_TWICE,
1778 CURL_FORMADD_UNKNOWN_OPTION,
1779 CURL_FORMADD_INCOMPLETE,
1780 CURL_FORMADD_ILLEGAL_ARRAY,
1781 CURL_FORMADD_DISABLED, /* libcurl was built with this disabled */
1783 CURL_FORMADD_LAST /* last */
1787 * NAME curl_formadd()
1791 * Pretty advanced function for building multi-part formposts. Each invoke
1792 * adds one part that together construct a full post. Then use
1793 * CURLOPT_HTTPPOST to send it off to libcurl.
1795 CURL_EXTERN CURLFORMcode curl_formadd(struct curl_httppost **httppost,
1796 struct curl_httppost **last_post,
1800 * callback function for curl_formget()
1801 * The void *arg pointer will be the one passed as second argument to
1803 * The character buffer passed to it must not be freed.
1804 * Should return the buffer length passed to it as the argument "len" on
1807 typedef size_t (*curl_formget_callback)(void *arg, const char *buf,
1811 * NAME curl_formget()
1815 * Serialize a curl_httppost struct built with curl_formadd().
1816 * Accepts a void pointer as second argument which will be passed to
1817 * the curl_formget_callback function.
1818 * Returns 0 on success.
1820 CURL_EXTERN int curl_formget(struct curl_httppost *form, void *arg,
1821 curl_formget_callback append);
1823 * NAME curl_formfree()
1827 * Free a multipart formpost previously built with curl_formadd().
1829 CURL_EXTERN void curl_formfree(struct curl_httppost *form);
1832 * NAME curl_getenv()
1836 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is
1837 * complete. DEPRECATED - see lib/README.curlx
1839 CURL_EXTERN char *curl_getenv(const char *variable);
1842 * NAME curl_version()
1846 * Returns a static ascii string of the libcurl version.
1848 CURL_EXTERN char *curl_version(void);
1851 * NAME curl_easy_escape()
1855 * Escapes URL strings (converts all letters consider illegal in URLs to their
1856 * %XX versions). This function returns a new allocated string or NULL if an
1859 CURL_EXTERN char *curl_easy_escape(CURL *handle,
1863 /* the previous version: */
1864 CURL_EXTERN char *curl_escape(const char *string,
1869 * NAME curl_easy_unescape()
1873 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit
1874 * versions). This function returns a new allocated string or NULL if an error
1876 * Conversion Note: On non-ASCII platforms the ASCII %XX codes are
1877 * converted into the host encoding.
1879 CURL_EXTERN char *curl_easy_unescape(CURL *handle,
1884 /* the previous version */
1885 CURL_EXTERN char *curl_unescape(const char *string,
1893 * Provided for de-allocation in the same translation unit that did the
1894 * allocation. Added in libcurl 7.10
1896 CURL_EXTERN void curl_free(void *p);
1899 * NAME curl_global_init()
1903 * curl_global_init() should be invoked exactly once for each application that
1904 * uses libcurl and before any call of other libcurl functions.
1906 * This function is not thread-safe!
1908 CURL_EXTERN CURLcode curl_global_init(long flags);
1911 * NAME curl_global_init_mem()
1915 * curl_global_init() or curl_global_init_mem() should be invoked exactly once
1916 * for each application that uses libcurl. This function can be used to
1917 * initialize libcurl and set user defined memory management callback
1918 * functions. Users can implement memory management routines to check for
1919 * memory leaks, check for mis-use of the curl library etc. User registered
1920 * callback routines with be invoked by this library instead of the system
1921 * memory management routines like malloc, free etc.
1923 CURL_EXTERN CURLcode curl_global_init_mem(long flags,
1924 curl_malloc_callback m,
1925 curl_free_callback f,
1926 curl_realloc_callback r,
1927 curl_strdup_callback s,
1928 curl_calloc_callback c);
1931 * NAME curl_global_cleanup()
1935 * curl_global_cleanup() should be invoked exactly once for each application
1938 CURL_EXTERN void curl_global_cleanup(void);
1940 /* linked-list structure for the CURLOPT_QUOTE option (and other) */
1943 struct curl_slist *next;
1947 * NAME curl_slist_append()
1951 * Appends a string to a linked list. If no list exists, it will be created
1952 * first. Returns the new list, after appending.
1954 CURL_EXTERN struct curl_slist *curl_slist_append(struct curl_slist *,
1958 * NAME curl_slist_free_all()
1962 * free a previously built curl_slist.
1964 CURL_EXTERN void curl_slist_free_all(struct curl_slist *);
1967 * NAME curl_getdate()
1971 * Returns the time, in seconds since 1 Jan 1970 of the time string given in
1972 * the first argument. The time argument in the second parameter is unused
1973 * and should be set to NULL.
1975 CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);
1977 /* info about the certificate chain, only for OpenSSL builds. Asked
1978 for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
1979 struct curl_certinfo {
1980 int num_of_certs; /* number of certificates with information */
1981 struct curl_slist **certinfo; /* for each index in this array, there's a
1982 linked list with textual information in the
1983 format "name: value" */
1986 #define CURLINFO_STRING 0x100000
1987 #define CURLINFO_LONG 0x200000
1988 #define CURLINFO_DOUBLE 0x300000
1989 #define CURLINFO_SLIST 0x400000
1990 #define CURLINFO_MASK 0x0fffff
1991 #define CURLINFO_TYPEMASK 0xf00000
1994 CURLINFO_NONE, /* first, never use this */
1995 CURLINFO_EFFECTIVE_URL = CURLINFO_STRING + 1,
1996 CURLINFO_RESPONSE_CODE = CURLINFO_LONG + 2,
1997 CURLINFO_TOTAL_TIME = CURLINFO_DOUBLE + 3,
1998 CURLINFO_NAMELOOKUP_TIME = CURLINFO_DOUBLE + 4,
1999 CURLINFO_CONNECT_TIME = CURLINFO_DOUBLE + 5,
2000 CURLINFO_PRETRANSFER_TIME = CURLINFO_DOUBLE + 6,
2001 CURLINFO_SIZE_UPLOAD = CURLINFO_DOUBLE + 7,
2002 CURLINFO_SIZE_DOWNLOAD = CURLINFO_DOUBLE + 8,
2003 CURLINFO_SPEED_DOWNLOAD = CURLINFO_DOUBLE + 9,
2004 CURLINFO_SPEED_UPLOAD = CURLINFO_DOUBLE + 10,
2005 CURLINFO_HEADER_SIZE = CURLINFO_LONG + 11,
2006 CURLINFO_REQUEST_SIZE = CURLINFO_LONG + 12,
2007 CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
2008 CURLINFO_FILETIME = CURLINFO_LONG + 14,
2009 CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
2010 CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
2011 CURLINFO_STARTTRANSFER_TIME = CURLINFO_DOUBLE + 17,
2012 CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
2013 CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
2014 CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
2015 CURLINFO_PRIVATE = CURLINFO_STRING + 21,
2016 CURLINFO_HTTP_CONNECTCODE = CURLINFO_LONG + 22,
2017 CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
2018 CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
2019 CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
2020 CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
2021 CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27,
2022 CURLINFO_COOKIELIST = CURLINFO_SLIST + 28,
2023 CURLINFO_LASTSOCKET = CURLINFO_LONG + 29,
2024 CURLINFO_FTP_ENTRY_PATH = CURLINFO_STRING + 30,
2025 CURLINFO_REDIRECT_URL = CURLINFO_STRING + 31,
2026 CURLINFO_PRIMARY_IP = CURLINFO_STRING + 32,
2027 CURLINFO_APPCONNECT_TIME = CURLINFO_DOUBLE + 33,
2028 CURLINFO_CERTINFO = CURLINFO_SLIST + 34,
2029 CURLINFO_CONDITION_UNMET = CURLINFO_LONG + 35,
2030 CURLINFO_RTSP_SESSION_ID = CURLINFO_STRING + 36,
2031 CURLINFO_RTSP_CLIENT_CSEQ = CURLINFO_LONG + 37,
2032 CURLINFO_RTSP_SERVER_CSEQ = CURLINFO_LONG + 38,
2033 CURLINFO_RTSP_CSEQ_RECV = CURLINFO_LONG + 39,
2034 CURLINFO_PRIMARY_PORT = CURLINFO_LONG + 40,
2035 CURLINFO_LOCAL_IP = CURLINFO_STRING + 41,
2036 CURLINFO_LOCAL_PORT = CURLINFO_LONG + 42,
2037 /* Fill in new entries below here! */
2039 CURLINFO_LASTONE = 42
2042 /* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
2043 CURLINFO_HTTP_CODE */
2044 #define CURLINFO_HTTP_CODE CURLINFO_RESPONSE_CODE
2047 CURLCLOSEPOLICY_NONE, /* first, never use this */
2049 CURLCLOSEPOLICY_OLDEST,
2050 CURLCLOSEPOLICY_LEAST_RECENTLY_USED,
2051 CURLCLOSEPOLICY_LEAST_TRAFFIC,
2052 CURLCLOSEPOLICY_SLOWEST,
2053 CURLCLOSEPOLICY_CALLBACK,
2055 CURLCLOSEPOLICY_LAST /* last, never use this */
2058 #define CURL_GLOBAL_SSL (1<<0)
2059 #define CURL_GLOBAL_WIN32 (1<<1)
2060 #define CURL_GLOBAL_ALL (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32)
2061 #define CURL_GLOBAL_NOTHING 0
2062 #define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
2063 #define CURL_GLOBAL_ACK_EINTR (1<<2)
2066 /*****************************************************************************
2067 * Setup defines, protos etc for the sharing stuff.
2070 /* Different data locks for a single share */
2072 CURL_LOCK_DATA_NONE = 0,
2073 /* CURL_LOCK_DATA_SHARE is used internally to say that
2074 * the locking is just made to change the internal state of the share
2077 CURL_LOCK_DATA_SHARE,
2078 CURL_LOCK_DATA_COOKIE,
2080 CURL_LOCK_DATA_SSL_SESSION,
2081 CURL_LOCK_DATA_CONNECT,
2085 /* Different lock access types */
2087 CURL_LOCK_ACCESS_NONE = 0, /* unspecified action */
2088 CURL_LOCK_ACCESS_SHARED = 1, /* for read perhaps */
2089 CURL_LOCK_ACCESS_SINGLE = 2, /* for write perhaps */
2090 CURL_LOCK_ACCESS_LAST /* never use */
2093 typedef void (*curl_lock_function)(CURL *handle,
2094 curl_lock_data data,
2095 curl_lock_access locktype,
2097 typedef void (*curl_unlock_function)(CURL *handle,
2098 curl_lock_data data,
2101 typedef void CURLSH;
2104 CURLSHE_OK, /* all is fine */
2105 CURLSHE_BAD_OPTION, /* 1 */
2106 CURLSHE_IN_USE, /* 2 */
2107 CURLSHE_INVALID, /* 3 */
2108 CURLSHE_NOMEM, /* 4 out of memory */
2109 CURLSHE_NOT_BUILT_IN, /* 5 feature not present in lib */
2110 CURLSHE_LAST /* never use */
2114 CURLSHOPT_NONE, /* don't use */
2115 CURLSHOPT_SHARE, /* specify a data type to share */
2116 CURLSHOPT_UNSHARE, /* specify which data type to stop sharing */
2117 CURLSHOPT_LOCKFUNC, /* pass in a 'curl_lock_function' pointer */
2118 CURLSHOPT_UNLOCKFUNC, /* pass in a 'curl_unlock_function' pointer */
2119 CURLSHOPT_USERDATA, /* pass in a user data pointer used in the lock/unlock
2120 callback functions */
2121 CURLSHOPT_LAST /* never use */
2124 CURL_EXTERN CURLSH *curl_share_init(void);
2125 CURL_EXTERN CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option, ...);
2126 CURL_EXTERN CURLSHcode curl_share_cleanup(CURLSH *);
2128 /****************************************************************************
2129 * Structures for querying information about the curl library at runtime.
2137 CURLVERSION_LAST /* never actually use this */
2140 /* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
2141 basically all programs ever that want to get version information. It is
2142 meant to be a built-in version number for what kind of struct the caller
2143 expects. If the struct ever changes, we redefine the NOW to another enum
2145 #define CURLVERSION_NOW CURLVERSION_FOURTH
2148 CURLversion age; /* age of the returned struct */
2149 const char *version; /* LIBCURL_VERSION */
2150 unsigned int version_num; /* LIBCURL_VERSION_NUM */
2151 const char *host; /* OS/host/cpu/machine when configured */
2152 int features; /* bitmask, see defines below */
2153 const char *ssl_version; /* human readable string */
2154 long ssl_version_num; /* not used anymore, always 0 */
2155 const char *libz_version; /* human readable string */
2156 /* protocols is terminated by an entry with a NULL protoname */
2157 const char * const *protocols;
2159 /* The fields below this were added in CURLVERSION_SECOND */
2163 /* This field was added in CURLVERSION_THIRD */
2166 /* These field were added in CURLVERSION_FOURTH */
2168 /* Same as '_libiconv_version' if built with HAVE_ICONV */
2171 const char *libssh_version; /* human readable string */
2173 } curl_version_info_data;
2175 #define CURL_VERSION_IPV6 (1<<0) /* IPv6-enabled */
2176 #define CURL_VERSION_KERBEROS4 (1<<1) /* kerberos auth is supported */
2177 #define CURL_VERSION_SSL (1<<2) /* SSL options are present */
2178 #define CURL_VERSION_LIBZ (1<<3) /* libz features are present */
2179 #define CURL_VERSION_NTLM (1<<4) /* NTLM auth is supported */
2180 #define CURL_VERSION_GSSNEGOTIATE (1<<5) /* Negotiate auth support */
2181 #define CURL_VERSION_DEBUG (1<<6) /* built with debug capabilities */
2182 #define CURL_VERSION_ASYNCHDNS (1<<7) /* asynchronous dns resolves */
2183 #define CURL_VERSION_SPNEGO (1<<8) /* SPNEGO auth */
2184 #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */
2185 #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */
2186 #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */
2187 #define CURL_VERSION_CONV (1<<12) /* character conversions supported */
2188 #define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */
2189 #define CURL_VERSION_TLSAUTH_SRP (1<<14) /* TLS-SRP auth is supported */
2190 #define CURL_VERSION_NTLM_WB (1<<15) /* NTLM delegating to winbind helper */
2191 #define CURL_VERSION_HTTP2 (1<<16) /* HTTP2 support built-in */
2194 * NAME curl_version_info()
2198 * This function returns a pointer to a static copy of the version info
2199 * struct. See above.
2201 CURL_EXTERN curl_version_info_data *curl_version_info(CURLversion);
2204 * NAME curl_easy_strerror()
2208 * The curl_easy_strerror function may be used to turn a CURLcode value
2209 * into the equivalent human readable error string. This is useful
2210 * for printing meaningful error messages.
2212 CURL_EXTERN const char *curl_easy_strerror(CURLcode);
2215 * NAME curl_share_strerror()
2219 * The curl_share_strerror function may be used to turn a CURLSHcode value
2220 * into the equivalent human readable error string. This is useful
2221 * for printing meaningful error messages.
2223 CURL_EXTERN const char *curl_share_strerror(CURLSHcode);
2226 * NAME curl_easy_pause()
2230 * The curl_easy_pause function pauses or unpauses transfers. Select the new
2231 * state by setting the bitmask, use the convenience defines below.
2234 CURL_EXTERN CURLcode curl_easy_pause(CURL *handle, int bitmask);
2236 #define CURLPAUSE_RECV (1<<0)
2237 #define CURLPAUSE_RECV_CONT (0)
2239 #define CURLPAUSE_SEND (1<<2)
2240 #define CURLPAUSE_SEND_CONT (0)
2242 #define CURLPAUSE_ALL (CURLPAUSE_RECV|CURLPAUSE_SEND)
2243 #define CURLPAUSE_CONT (CURLPAUSE_RECV_CONT|CURLPAUSE_SEND_CONT)
2249 /* unfortunately, the easy.h and multi.h include files need options and info
2250 stuff before they can be included! */
2251 #include "easy.h" /* nothing in curl is fun without the easy stuff */
2254 /* the typechecker doesn't work in C++ (yet) */
2255 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && \
2256 ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && \
2257 !defined(__cplusplus) && !defined(CURL_DISABLE_TYPECHECK)
2258 #include "typecheck-gcc.h"
2260 #if defined(__STDC__) && (__STDC__ >= 1)
2261 /* This preprocessor magic that replaces a call with the exact same call is
2262 only done to make sure application authors pass exactly three arguments
2263 to these functions. */
2264 #define curl_easy_setopt(handle,opt,param) curl_easy_setopt(handle,opt,param)
2265 #define curl_easy_getinfo(handle,info,arg) curl_easy_getinfo(handle,info,arg)
2266 #define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
2267 #define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
2268 #endif /* __STDC__ >= 1 */
2269 #endif /* gcc >= 4.3 && !__cplusplus */
2271 #endif /* __CURL_CURL_H */