1 /** 2 This is an interface to the libcurl library. 3 4 Converted to D from curl headers by $(LINK2 http://www.digitalmars.com/d/2.0/htod.html, htod) and 5 cleaned up by Jonas Drewsen (jdrewsen) 6 7 Windows x86 note: 8 A DMD compatible libcurl static library can be downloaded from the dlang.org 9 $(LINK2 http://dlang.org/download.html, download page). 10 */ 11 12 /* ************************************************************************** 13 * _ _ ____ _ 14 * Project ___| | | | _ \| | 15 * / __| | | | |_) | | 16 * | (__| |_| | _ <| |___ 17 * \___|\___/|_| \_\_____| 18 */ 19 20 /** 21 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. 22 * 23 * This software is licensed as described in the file COPYING, which 24 * you should have received as part of this distribution. The terms 25 * are also available at $(LINK http://curl.haxx.se/docs/copyright.html). 26 * 27 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 28 * copies of the Software, and permit persons to whom the Software is 29 * furnished to do so, under the terms of the COPYING file. 30 * 31 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 32 * KIND, either express or implied. 33 * 34 ***************************************************************************/ 35 36 module etc.c.curl; 37 38 version(WebAssembly) {} else: 39 40 import core.stdc.config; 41 import core.stdc.time; 42 import std.socket; 43 44 // linux 45 import core.sys.posix.sys.socket; 46 47 // 48 // LICENSE FROM CURL HEADERS 49 // 50 51 /** This is the global package copyright */ 52 enum LIBCURL_COPYRIGHT = "1996 - 2010 Daniel Stenberg, <daniel@haxx.se>."; 53 54 /** This is the version number of the libcurl package from which this header 55 file origins: */ 56 enum LIBCURL_VERSION = "7.21.4"; 57 58 /** The numeric version number is also available "in parts" by using these 59 constants */ 60 enum LIBCURL_VERSION_MAJOR = 7; 61 /// ditto 62 enum LIBCURL_VERSION_MINOR = 21; 63 /// ditto 64 enum LIBCURL_VERSION_PATCH = 4; 65 66 /** This is the numeric version of the libcurl version number, meant for easier 67 parsing and comparions by programs. The LIBCURL_VERSION_NUM define will 68 always follow this syntax: 69 70 0xXXYYZZ 71 72 Where XX, YY and ZZ are the main version, release and patch numbers in 73 hexadecimal (using 8 bits each). All three numbers are always represented 74 using two digits. 1.2 would appear as "0x010200" while version 9.11.7 75 appears as "0x090b07". 76 77 This 6-digit (24 bits) hexadecimal number does not show pre-release number, 78 and it is always a greater number in a more recent release. It makes 79 comparisons with greater than and less than work. 80 */ 81 82 enum LIBCURL_VERSION_NUM = 0x071504; 83 84 /** 85 * This is the date and time when the full source package was created. The 86 * timestamp is not stored in git, as the timestamp is properly set in the 87 * tarballs by the maketgz script. 88 * 89 * The format of the date should follow this template: 90 * 91 * "Mon Feb 12 11:35:33 UTC 2007" 92 */ 93 enum LIBCURL_TIMESTAMP = "Thu Feb 17 12:19:40 UTC 2011"; 94 95 /** Data type definition of curl_off_t. 96 * 97 * jdrewsen - Always 64bit signed and that is what long is in D. 98 * 99 * Comment below is from curlbuild.h: 100 * 101 * NOTE 2: 102 * 103 * For any given platform/compiler curl_off_t must be typedef'ed to a 104 * 64-bit wide signed integral data type. The width of this data type 105 * must remain constant and independent of any possible large file 106 * support settings. 107 * 108 * As an exception to the above, curl_off_t shall be typedef'ed to a 109 * 32-bit wide signed integral data type if there is no 64-bit type. 110 */ 111 alias curl_off_t = long; 112 113 /// 114 alias CURL = void; 115 116 /// jdrewsen - Get socket alias from std.socket 117 alias curl_socket_t = socket_t; 118 119 /// jdrewsen - Would like to get socket error constant from std.socket by it is private atm. 120 version (Windows) 121 { 122 import core.sys.windows.windows, core.sys.windows.winsock2; 123 enum CURL_SOCKET_BAD = SOCKET_ERROR; 124 } 125 version (Posix) enum CURL_SOCKET_BAD = -1; 126 127 /// 128 extern (C) struct curl_httppost 129 { 130 curl_httppost *next; /** next entry in the list */ 131 char *name; /** pointer to allocated name */ 132 c_long namelength; /** length of name length */ 133 char *contents; /** pointer to allocated data contents */ 134 c_long contentslength; /** length of contents field */ 135 char *buffer; /** pointer to allocated buffer contents */ 136 c_long bufferlength; /** length of buffer field */ 137 char *contenttype; /** Content-Type */ 138 curl_slist *contentheader; /** list of extra headers for this form */ 139 curl_httppost *more; /** if one field name has more than one 140 file, this link should link to following 141 files */ 142 c_long flags; /** as defined below */ 143 char *showfilename; /** The file name to show. If not set, the 144 actual file name will be used (if this 145 is a file part) */ 146 void *userp; /** custom pointer used for 147 HTTPPOST_CALLBACK posts */ 148 } 149 150 enum HTTPPOST_FILENAME = 1; /** specified content is a file name */ 151 enum HTTPPOST_READFILE = 2; /** specified content is a file name */ 152 enum HTTPPOST_PTRNAME = 4; /** name is only stored pointer 153 do not free in formfree */ 154 enum HTTPPOST_PTRCONTENTS = 8; /** contents is only stored pointer 155 do not free in formfree */ 156 enum HTTPPOST_BUFFER = 16; /** upload file from buffer */ 157 enum HTTPPOST_PTRBUFFER = 32; /** upload file from pointer contents */ 158 enum HTTPPOST_CALLBACK = 64; /** upload file contents by using the 159 regular read callback to get the data 160 and pass the given pointer as custom 161 pointer */ 162 163 /// 164 alias curl_progress_callback = int function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); 165 166 /** Tests have proven that 20K is a very bad buffer size for uploads on 167 Windows, while 16K for some odd reason performed a lot better. 168 We do the ifndef check to allow this value to easier be changed at build 169 time for those who feel adventurous. The practical minimum is about 170 400 bytes since libcurl uses a buffer of this size as a scratch area 171 (unrelated to network send operations). */ 172 enum CURL_MAX_WRITE_SIZE = 16_384; 173 174 /** The only reason to have a max limit for this is to avoid the risk of a bad 175 server feeding libcurl with a never-ending header that will cause reallocs 176 infinitely */ 177 enum CURL_MAX_HTTP_HEADER = (100*1024); 178 179 180 /** This is a magic return code for the write callback that, when returned, 181 will signal libcurl to pause receiving on the current transfer. */ 182 enum CURL_WRITEFUNC_PAUSE = 0x10000001; 183 184 /// 185 alias curl_write_callback = size_t function(char *buffer, size_t size, size_t nitems, void *outstream); 186 187 /** enumeration of file types */ 188 enum CurlFileType { 189 file, /// 190 directory, /// 191 symlink, /// 192 device_block, /// 193 device_char, /// 194 namedpipe, /// 195 socket, /// 196 door, /// 197 unknown /** is possible only on Sun Solaris now */ 198 } 199 200 /// 201 alias curlfiletype = int; 202 203 /// 204 enum CurlFInfoFlagKnown { 205 filename = 1, /// 206 filetype = 2, /// 207 time = 4, /// 208 perm = 8, /// 209 uid = 16, /// 210 gid = 32, /// 211 size = 64, /// 212 hlinkcount = 128 /// 213 } 214 215 /** Content of this structure depends on information which is known and is 216 achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man 217 page for callbacks returning this structure -- some fields are mandatory, 218 some others are optional. The FLAG field has special meaning. */ 219 220 221 /** If some of these fields is not NULL, it is a pointer to b_data. */ 222 extern (C) struct _N2 223 { 224 char *time; /// 225 char *perm; /// 226 char *user; /// 227 char *group; /// 228 char *target; /** pointer to the target filename of a symlink */ 229 } 230 231 /** Content of this structure depends on information which is known and is 232 achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man 233 page for callbacks returning this structure -- some fields are mandatory, 234 some others are optional. The FLAG field has special meaning. */ 235 extern (C) struct curl_fileinfo 236 { 237 char *filename; /// 238 curlfiletype filetype; /// 239 time_t time; /// 240 uint perm; /// 241 int uid; /// 242 int gid; /// 243 curl_off_t size; /// 244 c_long hardlinks; /// 245 _N2 strings; /// 246 uint flags; /// 247 char *b_data; /// 248 size_t b_size; /// 249 size_t b_used; /// 250 } 251 252 /** return codes for CURLOPT_CHUNK_BGN_FUNCTION */ 253 enum CurlChunkBgnFunc { 254 ok = 0, /// 255 fail = 1, /** tell the lib to end the task */ 256 skip = 2 /** skip this chunk over */ 257 } 258 259 /** if splitting of data transfer is enabled, this callback is called before 260 download of an individual chunk started. Note that parameter "remains" works 261 only for FTP wildcard downloading (for now), otherwise is not used */ 262 alias curl_chunk_bgn_callback = c_long function(const(void) *transfer_info, void *ptr, int remains); 263 264 /** return codes for CURLOPT_CHUNK_END_FUNCTION */ 265 enum CurlChunkEndFunc { 266 ok = 0, /// 267 fail = 1, /// 268 } 269 /** If splitting of data transfer is enabled this callback is called after 270 download of an individual chunk finished. 271 Note! After this callback was set then it have to be called FOR ALL chunks. 272 Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC. 273 This is the reason why we don't need "transfer_info" parameter in this 274 callback and we are not interested in "remains" parameter too. */ 275 alias curl_chunk_end_callback = c_long function(void *ptr); 276 277 /** return codes for FNMATCHFUNCTION */ 278 enum CurlFnMAtchFunc { 279 match = 0, /// 280 nomatch = 1, /// 281 fail = 2 /// 282 } 283 284 /** callback type for wildcard downloading pattern matching. If the 285 string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */ 286 alias curl_fnmatch_callback = int function(void *ptr, in const(char) *pattern, in const(char) *string); 287 288 /// seek whence... 289 enum CurlSeekPos { 290 set, /// 291 current, /// 292 end /// 293 } 294 295 /** These are the return codes for the seek callbacks */ 296 enum CurlSeek { 297 ok, /// 298 fail, /** fail the entire transfer */ 299 cantseek /** tell libcurl seeking can't be done, so 300 libcurl might try other means instead */ 301 } 302 303 /// 304 alias curl_seek_callback = int function(void *instream, curl_off_t offset, int origin); 305 306 /// 307 enum CurlReadFunc { 308 /** This is a return code for the read callback that, when returned, will 309 signal libcurl to immediately abort the current transfer. */ 310 abort = 0x10000000, 311 312 /** This is a return code for the read callback that, when returned, 313 will const signal libcurl to pause sending data on the current 314 transfer. */ 315 pause = 0x10000001 316 } 317 318 /// 319 alias curl_read_callback = size_t function(char *buffer, size_t size, size_t nitems, void *instream); 320 321 /// 322 enum CurlSockType { 323 ipcxn, /** socket created for a specific IP connection */ 324 last /** never use */ 325 } 326 /// 327 alias curlsocktype = int; 328 329 /// 330 alias curl_sockopt_callback = int function(void *clientp, curl_socket_t curlfd, curlsocktype purpose); 331 332 /** addrlen was a socklen_t type before 7.18.0 but it turned really 333 ugly and painful on the systems that lack this type */ 334 extern (C) struct curl_sockaddr 335 { 336 int family; /// 337 int socktype; /// 338 int protocol; /// 339 uint addrlen; /** addrlen was a socklen_t type before 7.18.0 but it 340 turned really ugly and painful on the systems that 341 lack this type */ 342 sockaddr addr; /// 343 } 344 345 /// 346 alias curl_opensocket_callback = curl_socket_t function(void *clientp, curlsocktype purpose, curl_sockaddr *address); 347 348 /// 349 enum CurlIoError 350 { 351 ok, /** I/O operation successful */ 352 unknowncmd, /** command was unknown to callback */ 353 failrestart, /** failed to restart the read */ 354 last /** never use */ 355 } 356 /// 357 alias curlioerr = int; 358 359 /// 360 enum CurlIoCmd { 361 nop, /** command was unknown to callback */ 362 restartread, /** failed to restart the read */ 363 last, /** never use */ 364 } 365 /// 366 alias curliocmd = int; 367 368 /// 369 alias curl_ioctl_callback = curlioerr function(CURL *handle, int cmd, void *clientp); 370 371 /** 372 * The following typedef's are signatures of malloc, free, realloc, strdup and 373 * calloc respectively. Function pointers of these types can be passed to the 374 * curl_global_init_mem() function to set user defined memory management 375 * callback routines. 376 */ 377 alias curl_malloc_callback = void* function(size_t size); 378 /// ditto 379 alias curl_free_callback = void function(void *ptr); 380 /// ditto 381 alias curl_realloc_callback = void* function(void *ptr, size_t size); 382 /// ditto 383 alias curl_strdup_callback = char * function(in const(char) *str); 384 /// ditto 385 alias curl_calloc_callback = void* function(size_t nmemb, size_t size); 386 387 /** the kind of data that is passed to information_callback*/ 388 enum CurlCallbackInfo { 389 text, /// 390 header_in, /// 391 header_out, /// 392 data_in, /// 393 data_out, /// 394 ssl_data_in, /// 395 ssl_data_out, /// 396 end /// 397 } 398 /// 399 alias curl_infotype = int; 400 401 /// 402 alias curl_debug_callback = 403 int function(CURL *handle, /** the handle/transfer this concerns */ 404 curl_infotype type, /** what kind of data */ 405 char *data, /** points to the data */ 406 size_t size, /** size of the data pointed to */ 407 void *userptr /** whatever the user please */ 408 ); 409 410 /** All possible error codes from all sorts of curl functions. Future versions 411 may return other values, stay prepared. 412 413 Always add new return codes last. Never *EVER* remove any. The return 414 codes must remain the same! 415 */ 416 enum CurlError 417 { 418 ok, /// 419 unsupported_protocol, /** 1 */ 420 failed_init, /** 2 */ 421 url_malformat, /** 3 */ 422 not_built_in, /** 4 - [was obsoleted in August 2007 for 423 7.17.0, reused in April 2011 for 7.21.5] */ 424 couldnt_resolve_proxy, /** 5 */ 425 couldnt_resolve_host, /** 6 */ 426 couldnt_connect, /** 7 */ 427 ftp_weird_server_reply, /** 8 */ 428 remote_access_denied, /** 9 a service was denied by the server 429 due to lack of access - when login fails 430 this is not returned. */ 431 obsolete10, /** 10 - NOT USED */ 432 ftp_weird_pass_reply, /** 11 */ 433 obsolete12, /** 12 - NOT USED */ 434 ftp_weird_pasv_reply, /** 13 */ 435 ftp_weird_227_format, /** 14 */ 436 ftp_cant_get_host, /** 15 */ 437 obsolete16, /** 16 - NOT USED */ 438 ftp_couldnt_set_type, /** 17 */ 439 partial_file, /** 18 */ 440 ftp_couldnt_retr_file, /** 19 */ 441 obsolete20, /** 20 - NOT USED */ 442 quote_error, /** 21 - quote command failure */ 443 http_returned_error, /** 22 */ 444 write_error, /** 23 */ 445 obsolete24, /** 24 - NOT USED */ 446 upload_failed, /** 25 - failed upload "command" */ 447 read_error, /** 26 - couldn't open/read from file */ 448 out_of_memory, /** 27 */ 449 /** Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error 450 instead of a memory allocation error if CURL_DOES_CONVERSIONS 451 is defined 452 */ 453 operation_timedout, /** 28 - the timeout time was reached */ 454 obsolete29, /** 29 - NOT USED */ 455 ftp_port_failed, /** 30 - FTP PORT operation failed */ 456 ftp_couldnt_use_rest, /** 31 - the REST command failed */ 457 obsolete32, /** 32 - NOT USED */ 458 range_error, /** 33 - RANGE "command" didn't work */ 459 http_post_error, /** 34 */ 460 ssl_connect_error, /** 35 - wrong when connecting with SSL */ 461 bad_download_resume, /** 36 - couldn't resume download */ 462 file_couldnt_read_file, /** 37 */ 463 ldap_cannot_bind, /** 38 */ 464 ldap_search_failed, /** 39 */ 465 obsolete40, /** 40 - NOT USED */ 466 function_not_found, /** 41 */ 467 aborted_by_callback, /** 42 */ 468 bad_function_argument, /** 43 */ 469 obsolete44, /** 44 - NOT USED */ 470 interface_failed, /** 45 - CURLOPT_INTERFACE failed */ 471 obsolete46, /** 46 - NOT USED */ 472 too_many_redirects, /** 47 - catch endless re-direct loops */ 473 unknown_option, /** 48 - User specified an unknown option */ 474 telnet_option_syntax, /** 49 - Malformed telnet option */ 475 obsolete50, /** 50 - NOT USED */ 476 peer_failed_verification, /** 51 - peer's certificate or fingerprint 477 wasn't verified fine */ 478 got_nothing, /** 52 - when this is a specific error */ 479 ssl_engine_notfound, /** 53 - SSL crypto engine not found */ 480 ssl_engine_setfailed, /** 54 - can not set SSL crypto engine as default */ 481 send_error, /** 55 - failed sending network data */ 482 recv_error, /** 56 - failure in receiving network data */ 483 obsolete57, /** 57 - NOT IN USE */ 484 ssl_certproblem, /** 58 - problem with the local certificate */ 485 ssl_cipher, /** 59 - couldn't use specified cipher */ 486 ssl_cacert, /** 60 - problem with the CA cert (path?) */ 487 bad_content_encoding, /** 61 - Unrecognized transfer encoding */ 488 ldap_invalid_url, /** 62 - Invalid LDAP URL */ 489 filesize_exceeded, /** 63 - Maximum file size exceeded */ 490 use_ssl_failed, /** 64 - Requested FTP SSL level failed */ 491 send_fail_rewind, /** 65 - Sending the data requires a rewind that failed */ 492 ssl_engine_initfailed, /** 66 - failed to initialise ENGINE */ 493 login_denied, /** 67 - user, password or similar was not accepted and we failed to login */ 494 tftp_notfound, /** 68 - file not found on server */ 495 tftp_perm, /** 69 - permission problem on server */ 496 remote_disk_full, /** 70 - out of disk space on server */ 497 tftp_illegal, /** 71 - Illegal TFTP operation */ 498 tftp_unknownid, /** 72 - Unknown transfer ID */ 499 remote_file_exists, /** 73 - File already exists */ 500 tftp_nosuchuser, /** 74 - No such user */ 501 conv_failed, /** 75 - conversion failed */ 502 conv_reqd, /** 76 - caller must register conversion 503 callbacks using curl_easy_setopt options 504 CURLOPT_CONV_FROM_NETWORK_FUNCTION, 505 CURLOPT_CONV_TO_NETWORK_FUNCTION, and 506 CURLOPT_CONV_FROM_UTF8_FUNCTION */ 507 ssl_cacert_badfile, /** 77 - could not load CACERT file, missing or wrong format */ 508 remote_file_not_found, /** 78 - remote file not found */ 509 ssh, /** 79 - error from the SSH layer, somewhat 510 generic so the error message will be of 511 interest when this has happened */ 512 ssl_shutdown_failed, /** 80 - Failed to shut down the SSL connection */ 513 again, /** 81 - socket is not ready for send/recv, 514 wait till it's ready and try again (Added 515 in 7.18.2) */ 516 ssl_crl_badfile, /** 82 - could not load CRL file, missing or wrong format (Added in 7.19.0) */ 517 ssl_issuer_error, /** 83 - Issuer check failed. (Added in 7.19.0) */ 518 ftp_pret_failed, /** 84 - a PRET command failed */ 519 rtsp_cseq_error, /** 85 - mismatch of RTSP CSeq numbers */ 520 rtsp_session_error, /** 86 - mismatch of RTSP Session Identifiers */ 521 ftp_bad_file_list, /** 87 - unable to parse FTP file list */ 522 chunk_failed, /** 88 - chunk callback reported error */ 523 curl_last /** never use! */ 524 } 525 /// 526 alias CURLcode = int; 527 528 /** This prototype applies to all conversion callbacks */ 529 alias curl_conv_callback = CURLcode function(char *buffer, size_t length); 530 531 /** actually an OpenSSL SSL_CTX */ 532 alias curl_ssl_ctx_callback = 533 CURLcode function(CURL *curl, /** easy handle */ 534 void *ssl_ctx, /** actually an OpenSSL SSL_CTX */ 535 void *userptr 536 ); 537 538 /// 539 enum CurlProxy { 540 http, /** added in 7.10, new in 7.19.4 default is to use CONNECT HTTP/1.1 */ 541 http_1_0, /** added in 7.19.4, force to use CONNECT HTTP/1.0 */ 542 socks4 = 4, /** support added in 7.15.2, enum existed already in 7.10 */ 543 socks5 = 5, /** added in 7.10 */ 544 socks4a = 6, /** added in 7.18.0 */ 545 socks5_hostname =7 /** Use the SOCKS5 protocol but pass along the 546 host name rather than the IP address. added 547 in 7.18.0 */ 548 } 549 /// 550 alias curl_proxytype = int; 551 552 /// 553 enum CurlAuth : ulong { 554 none = 0UL, /** None */ 555 basic = 1UL << 0, /** Basic (default) */ 556 digest = 1UL << 1, /** Digest */ 557 negotiate = 1UL << 2, /** Negotiate (SPNEGO) */ 558 gssnegotiate = negotiate, /** GSS-Negotiate */ 559 gssapi = negotiate, /** GSS-Negoatiate */ 560 ntlm = 1UL << 3, /** NTLM */ 561 digest_ie = 1UL << 4, /** Digest with IE flavour */ 562 ntlm_WB = 1UL << 5, /** NTML delegated to winbind helper */ 563 bearer = 1UL << 6, /** Bearer token authentication */ 564 only = 1UL << 31, /** used together with a single other 565 type to force no auth or just that 566 single type */ 567 any = ~digest_ie, /** any allows */ 568 anysafe = ~(basic | digest_ie) /** any except basic */ 569 } 570 571 /// 572 enum CurlSshAuth { 573 any = ~0, /** all types supported by the server */ 574 none = 0, /** none allowed, silly but complete */ 575 publickey = 1 << 0, /** public/private key files */ 576 password = 1 << 1, /** password */ 577 host = 1 << 2, /** host key files */ 578 keyboard = 1 << 3, /** keyboard interactive */ 579 agent = 1 << 4, /** agent (ssh-agent, pageant...) */ 580 gssapi = 1 << 5, /** gssapi (kerberos, ...) */ 581 582 default_ = any // CURLSSH_AUTH_ANY; 583 } 584 /// 585 enum CURL_ERROR_SIZE = 256; 586 /** points to a zero-terminated string encoded with base64 587 if len is zero, otherwise to the "raw" data */ 588 enum CurlKHType 589 { 590 unknown, /// 591 rsa1, /// 592 rsa, /// 593 dss /// 594 } 595 /// 596 extern (C) struct curl_khkey 597 { 598 const(char) *key; /** points to a zero-terminated string encoded with base64 599 if len is zero, otherwise to the "raw" data */ 600 size_t len; /// 601 CurlKHType keytype; /// 602 } 603 604 /** this is the set of return values expected from the curl_sshkeycallback 605 callback */ 606 enum CurlKHStat { 607 fine_add_to_file, /// 608 fine, /// 609 reject, /** reject the connection, return an error */ 610 defer, /** do not accept it, but we can't answer right now so 611 this causes a CURLE_DEFER error but otherwise the 612 connection will be left intact etc */ 613 last /** not for use, only a marker for last-in-list */ 614 } 615 616 /** this is the set of status codes pass in to the callback */ 617 enum CurlKHMatch { 618 ok, /** match */ 619 mismatch, /** host found, key mismatch! */ 620 missing, /** no matching host/key found */ 621 last /** not for use, only a marker for last-in-list */ 622 } 623 624 /// 625 alias curl_sshkeycallback = 626 int function(CURL *easy, /** easy handle */ 627 const(curl_khkey) *knownkey, /** known */ 628 const(curl_khkey) *foundkey, /** found */ 629 CurlKHMatch m, /** libcurl's view on the keys */ 630 void *clientp /** custom pointer passed from app */ 631 ); 632 633 /** parameter for the CURLOPT_USE_SSL option */ 634 enum CurlUseSSL { 635 none, /** do not attempt to use SSL */ 636 tryssl, /** try using SSL, proceed anyway otherwise */ 637 control, /** SSL for the control connection or fail */ 638 all, /** SSL for all communication or fail */ 639 last /** not an option, never use */ 640 } 641 /// 642 alias curl_usessl = int; 643 644 /** parameter for the CURLOPT_FTP_SSL_CCC option */ 645 enum CurlFtpSSL { 646 ccc_none, /** do not send CCC */ 647 ccc_passive, /** Let the server initiate the shutdown */ 648 ccc_active, /** Initiate the shutdown */ 649 ccc_last /** not an option, never use */ 650 } 651 /// 652 alias curl_ftpccc = int; 653 654 /** parameter for the CURLOPT_FTPSSLAUTH option */ 655 enum CurlFtpAuth { 656 defaultauth, /** let libcurl decide */ 657 ssl, /** use "AUTH SSL" */ 658 tls, /** use "AUTH TLS" */ 659 last /** not an option, never use */ 660 } 661 /// 662 alias curl_ftpauth = int; 663 664 /** parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */ 665 enum CurlFtp { 666 create_dir_none, /** do NOT create missing dirs! */ 667 create_dir, /** (FTP/SFTP) if CWD fails, try MKD and then CWD again if MKD 668 succeeded, for SFTP this does similar magic */ 669 create_dir_retry, /** (FTP only) if CWD fails, try MKD and then CWD again even if MKD 670 failed! */ 671 create_dir_last /** not an option, never use */ 672 } 673 /// 674 alias curl_ftpcreatedir = int; 675 676 /** parameter for the CURLOPT_FTP_FILEMETHOD option */ 677 enum CurlFtpMethod { 678 defaultmethod, /** let libcurl pick */ 679 multicwd, /** single CWD operation for each path part */ 680 nocwd, /** no CWD at all */ 681 singlecwd, /** one CWD to full dir, then work on file */ 682 last /** not an option, never use */ 683 } 684 /// 685 alias curl_ftpmethod = int; 686 687 /** CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */ 688 enum CurlProto { 689 http = 1, /// 690 https = 2, /// 691 ftp = 4, /// 692 ftps = 8, /// 693 scp = 16, /// 694 sftp = 32, /// 695 telnet = 64, /// 696 ldap = 128, /// 697 ldaps = 256, /// 698 dict = 512, /// 699 file = 1024, /// 700 tftp = 2048, /// 701 imap = 4096, /// 702 imaps = 8192, /// 703 pop3 = 16_384, /// 704 pop3s = 32_768, /// 705 smtp = 65_536, /// 706 smtps = 131_072, /// 707 rtsp = 262_144, /// 708 rtmp = 524_288, /// 709 rtmpt = 1_048_576, /// 710 rtmpe = 2_097_152, /// 711 rtmpte = 4_194_304, /// 712 rtmps = 8_388_608, /// 713 rtmpts = 16_777_216, /// 714 gopher = 33_554_432, /// 715 all = -1 /** enable everything */ 716 } 717 718 /** long may be 32 or 64 bits, but we should never depend on anything else 719 but 32 */ 720 enum CURLOPTTYPE_LONG = 0; 721 /// ditto 722 enum CURLOPTTYPE_OBJECTPOINT = 10_000; 723 /// ditto 724 enum CURLOPTTYPE_FUNCTIONPOINT = 20_000; 725 726 /// ditto 727 enum CURLOPTTYPE_OFF_T = 30_000; 728 /** name is uppercase CURLOPT_$(LT)name$(GT), 729 type is one of the defined CURLOPTTYPE_$(LT)type$(GT) 730 number is unique identifier */ 731 732 /** The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */ 733 alias LONG = CURLOPTTYPE_LONG; 734 /// ditto 735 alias OBJECTPOINT = CURLOPTTYPE_OBJECTPOINT; 736 /// ditto 737 alias FUNCTIONPOINT = CURLOPTTYPE_FUNCTIONPOINT; 738 739 /// ditto 740 alias OFF_T = CURLOPTTYPE_OFF_T; 741 742 /// 743 enum CurlOption { 744 /** This is the FILE * or void * the regular output should be written to. */ 745 file = 10_001, 746 /** The full URL to get/put */ 747 url, 748 /** Port number to connect to, if other than default. */ 749 port = 3, 750 /** Name of proxy to use. */ 751 proxy = 10_004, 752 /** "name:password" to use when fetching. */ 753 userpwd, 754 /** "name:password" to use with proxy. */ 755 proxyuserpwd, 756 /** Range to get, specified as an ASCII string. */ 757 range, 758 /** not used */ 759 760 /** Specified file stream to upload from (use as input): */ 761 infile = 10_009, 762 /** Buffer to receive error messages in, must be at least CURL_ERROR_SIZE 763 * bytes big. If this is not used, error messages go to stderr instead: */ 764 errorbuffer, 765 /** Function that will be called to store the output (instead of fwrite). The 766 * parameters will use fwrite() syntax, make sure to follow them. */ 767 writefunction = 20_011, 768 /** Function that will be called to read the input (instead of fread). The 769 * parameters will use fread() syntax, make sure to follow them. */ 770 readfunction, 771 /** Time-out the read operation after this amount of seconds */ 772 timeout = 13, 773 /** If the CURLOPT_INFILE is used, this can be used to inform libcurl about 774 * how large the file being sent really is. That allows better error 775 * checking and better verifies that the upload was successful. -1 means 776 * unknown size. 777 * 778 * For large file support, there is also a _LARGE version of the key 779 * which takes an off_t type, allowing platforms with larger off_t 780 * sizes to handle larger files. See below for INFILESIZE_LARGE. 781 */ 782 infilesize, 783 /** POST static input fields. */ 784 postfields = 10_015, 785 /** Set the referrer page (needed by some CGIs) */ 786 referer, 787 /** Set the FTP PORT string (interface name, named or numerical IP address) 788 Use i.e '-' to use default address. */ 789 ftpport, 790 /** Set the User-Agent string (examined by some CGIs) */ 791 useragent, 792 /** If the download receives less than "low speed limit" bytes/second 793 * during "low speed time" seconds, the operations is aborted. 794 * You could i.e if you have a pretty high speed connection, abort if 795 * it is less than 2000 bytes/sec during 20 seconds. 796 */ 797 798 /** Set the "low speed limit" */ 799 low_speed_limit = 19, 800 /** Set the "low speed time" */ 801 low_speed_time, 802 /** Set the continuation offset. 803 * 804 * Note there is also a _LARGE version of this key which uses 805 * off_t types, allowing for large file offsets on platforms which 806 * use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE. 807 */ 808 resume_from, 809 /** Set cookie in request: */ 810 cookie = 10_022, 811 /** This points to a linked list of headers, struct curl_slist kind */ 812 httpheader, 813 /** This points to a linked list of post entries, struct curl_httppost */ 814 httppost, 815 /** name of the file keeping your private SSL-certificate */ 816 sslcert, 817 /** password for the SSL or SSH private key */ 818 keypasswd, 819 /** send TYPE parameter? */ 820 crlf = 27, 821 /** send linked-list of QUOTE commands */ 822 quote = 10_028, 823 /** send FILE * or void * to store headers to, if you use a callback it 824 is simply passed to the callback unmodified */ 825 writeheader, 826 /** point to a file to read the initial cookies from, also enables 827 "cookie awareness" */ 828 cookiefile = 10_031, 829 /** What version to specifically try to use. 830 See CURL_SSLVERSION defines below. */ 831 sslversion = 32, 832 /** What kind of HTTP time condition to use, see defines */ 833 timecondition, 834 /** Time to use with the above condition. Specified in number of seconds 835 since 1 Jan 1970 */ 836 timevalue, 837 /* 35 = OBSOLETE */ 838 839 /** Custom request, for customizing the get command like 840 HTTP: DELETE, TRACE and others 841 FTP: to use a different list command 842 */ 843 customrequest = 10_036, 844 /** HTTP request, for odd commands like DELETE, TRACE and others */ 845 stderr, 846 /* 38 is not used */ 847 848 /** send linked-list of post-transfer QUOTE commands */ 849 postquote = 10_039, 850 /** Pass a pointer to string of the output using full variable-replacement 851 as described elsewhere. */ 852 writeinfo, 853 verbose = 41, /** talk a lot */ 854 header, /** throw the header out too */ 855 noprogress, /** shut off the progress meter */ 856 nobody, /** use HEAD to get http document */ 857 failonerror, /** no output on http error codes >= 300 */ 858 upload, /** this is an upload */ 859 post, /** HTTP POST method */ 860 dirlistonly, /** return bare names when listing directories */ 861 append = 50, /** Append instead of overwrite on upload! */ 862 /** Specify whether to read the user+password from the .netrc or the URL. 863 * This must be one of the CURL_NETRC_* enums below. */ 864 netrc, 865 followlocation, /** use Location: Luke! */ 866 transfertext, /** transfer data in text/ASCII format */ 867 put, /** HTTP PUT */ 868 /* 55 = OBSOLETE */ 869 870 /** Function that will be called instead of the internal progress display 871 * function. This function should be defined as the curl_progress_callback 872 * prototype defines. */ 873 progressfunction = 20_056, 874 /** Data passed to the progress callback */ 875 progressdata = 10_057, 876 /** We want the referrer field set automatically when following locations */ 877 autoreferer = 58, 878 /** Port of the proxy, can be set in the proxy string as well with: 879 `[host]:[port]` */ 880 proxyport, 881 /** size of the POST input data, if strlen() is not good to use */ 882 postfieldsize, 883 /** tunnel non-http operations through a HTTP proxy */ 884 httpproxytunnel, 885 /** Set the interface string to use as outgoing network interface */ 886 intrface = 10_062, 887 /** Set the krb4/5 security level, this also enables krb4/5 awareness. This 888 * is a string, 'clear', 'safe', 'confidential' or 'private'. If the string 889 * is set but doesn't match one of these, 'private' will be used. */ 890 krblevel, 891 /** Set if we should verify the peer in ssl handshake, set 1 to verify. */ 892 ssl_verifypeer = 64, 893 /** The CApath or CAfile used to validate the peer certificate 894 this option is used only if SSL_VERIFYPEER is true */ 895 cainfo = 10_065, 896 /* 66 = OBSOLETE */ 897 /* 67 = OBSOLETE */ 898 899 /** Maximum number of http redirects to follow */ 900 maxredirs = 68, 901 /** Pass a long set to 1 to get the date of the requested document (if 902 possible)! Pass a zero to shut it off. */ 903 filetime, 904 /** This points to a linked list of telnet options */ 905 telnetoptions = 10_070, 906 /** Max amount of cached alive connections */ 907 maxconnects = 71, 908 /** What policy to use when closing connections when the cache is filled 909 up */ 910 closepolicy, 911 /* 73 = OBSOLETE */ 912 913 /** Set to explicitly use a new connection for the upcoming transfer. 914 Do not use this unless you're absolutely sure of this, as it makes the 915 operation slower and is less friendly for the network. */ 916 fresh_connect = 74, 917 /** Set to explicitly forbid the upcoming transfer's connection to be re-used 918 when done. Do not use this unless you're absolutely sure of this, as it 919 makes the operation slower and is less friendly for the network. */ 920 forbid_reuse, 921 /** Set to a file name that contains random data for libcurl to use to 922 seed the random engine when doing SSL connects. */ 923 random_file = 10_076, 924 /** Set to the Entropy Gathering Daemon socket pathname */ 925 egdsocket, 926 /** Time-out connect operations after this amount of seconds, if connects 927 are OK within this time, then fine... This only aborts the connect 928 phase. [Only works on unix-style/SIGALRM operating systems] */ 929 connecttimeout = 78, 930 /** Function that will be called to store headers (instead of fwrite). The 931 * parameters will use fwrite() syntax, make sure to follow them. */ 932 headerfunction = 20_079, 933 /** Set this to force the HTTP request to get back to GET. Only really usable 934 if POST, PUT or a custom request have been used first. 935 */ 936 httpget = 80, 937 /** Set if we should verify the Common name from the peer certificate in ssl 938 * handshake, set 1 to check existence, 2 to ensure that it matches the 939 * provided hostname. */ 940 ssl_verifyhost, 941 /** Specify which file name to write all known cookies in after completed 942 operation. Set file name to "-" (dash) to make it go to stdout. */ 943 cookiejar = 10_082, 944 /** Specify which SSL ciphers to use */ 945 ssl_cipher_list, 946 /** Specify which HTTP version to use! This must be set to one of the 947 CURL_HTTP_VERSION* enums set below. */ 948 http_version = 84, 949 /** Specifically switch on or off the FTP engine's use of the EPSV command. By 950 default, that one will always be attempted before the more traditional 951 PASV command. */ 952 ftp_use_epsv, 953 /** type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */ 954 sslcerttype = 10_086, 955 /** name of the file keeping your private SSL-key */ 956 sslkey, 957 /** type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */ 958 sslkeytype, 959 /** crypto engine for the SSL-sub system */ 960 sslengine, 961 /** set the crypto engine for the SSL-sub system as default 962 the param has no meaning... 963 */ 964 sslengine_default = 90, 965 /** Non-zero value means to use the global dns cache */ 966 dns_use_global_cache, 967 /** DNS cache timeout */ 968 dns_cache_timeout, 969 /** send linked-list of pre-transfer QUOTE commands */ 970 prequote = 10_093, 971 /** set the debug function */ 972 debugfunction = 20_094, 973 /** set the data for the debug function */ 974 debugdata = 10_095, 975 /** mark this as start of a cookie session */ 976 cookiesession = 96, 977 /** The CApath directory used to validate the peer certificate 978 this option is used only if SSL_VERIFYPEER is true */ 979 capath = 10_097, 980 /** Instruct libcurl to use a smaller receive buffer */ 981 buffersize = 98, 982 /** Instruct libcurl to not use any signal/alarm handlers, even when using 983 timeouts. This option is useful for multi-threaded applications. 984 See libcurl-the-guide for more background information. */ 985 nosignal, 986 /** Provide a CURLShare for mutexing non-ts data */ 987 share = 10_100, 988 /** indicates type of proxy. accepted values are CURLPROXY_HTTP (default), 989 CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ 990 proxytype = 101, 991 /** Set the Accept-Encoding string. Use this to tell a server you would like 992 the response to be compressed. */ 993 encoding = 10_102, 994 /** Set pointer to private data */ 995 private_opt, 996 /** Set aliases for HTTP 200 in the HTTP Response header */ 997 http200aliases, 998 /** Continue to send authentication (user+password) when following locations, 999 even when hostname changed. This can potentially send off the name 1000 and password to whatever host the server decides. */ 1001 unrestricted_auth = 105, 1002 /** Specifically switch on or off the FTP engine's use of the EPRT command ( it 1003 also disables the LPRT attempt). By default, those ones will always be 1004 attempted before the good old traditional PORT command. */ 1005 ftp_use_eprt, 1006 /** Set this to a bitmask value to enable the particular authentications 1007 methods you like. Use this in combination with CURLOPT_USERPWD. 1008 Note that setting multiple bits may cause extra network round-trips. */ 1009 httpauth, 1010 /** Set the ssl context callback function, currently only for OpenSSL ssl_ctx 1011 in second argument. The function must be matching the 1012 curl_ssl_ctx_callback proto. */ 1013 ssl_ctx_function = 20_108, 1014 /** Set the userdata for the ssl context callback function's third 1015 argument */ 1016 ssl_ctx_data = 10_109, 1017 /** FTP Option that causes missing dirs to be created on the remote server. 1018 In 7.19.4 we introduced the convenience enums for this option using the 1019 CURLFTP_CREATE_DIR prefix. 1020 */ 1021 ftp_create_missing_dirs = 110, 1022 /** Set this to a bitmask value to enable the particular authentications 1023 methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. 1024 Note that setting multiple bits may cause extra network round-trips. */ 1025 proxyauth, 1026 /** FTP option that changes the timeout, in seconds, associated with 1027 getting a response. This is different from transfer timeout time and 1028 essentially places a demand on the FTP server to acknowledge commands 1029 in a timely manner. */ 1030 ftp_response_timeout, 1031 /** Set this option to one of the CURL_IPRESOLVE_* defines (see below) to 1032 tell libcurl to resolve names to those IP versions only. This only has 1033 affect on systems with support for more than one, i.e IPv4 _and_ IPv6. */ 1034 ipresolve, 1035 /** Set this option to limit the size of a file that will be downloaded from 1036 an HTTP or FTP server. 1037 1038 Note there is also _LARGE version which adds large file support for 1039 platforms which have larger off_t sizes. See MAXFILESIZE_LARGE below. */ 1040 maxfilesize, 1041 /** See the comment for INFILESIZE above, but in short, specifies 1042 * the size of the file being uploaded. -1 means unknown. 1043 */ 1044 infilesize_large = 30_115, 1045 /** Sets the continuation offset. There is also a LONG version of this; 1046 * look above for RESUME_FROM. 1047 */ 1048 resume_from_large, 1049 /** Sets the maximum size of data that will be downloaded from 1050 * an HTTP or FTP server. See MAXFILESIZE above for the LONG version. 1051 */ 1052 maxfilesize_large, 1053 /** Set this option to the file name of your .netrc file you want libcurl 1054 to parse (using the CURLOPT_NETRC option). If not set, libcurl will do 1055 a poor attempt to find the user's home directory and check for a .netrc 1056 file in there. */ 1057 netrc_file = 10_118, 1058 /** Enable SSL/TLS for FTP, pick one of: 1059 CURLFTPSSL_TRY - try using SSL, proceed anyway otherwise 1060 CURLFTPSSL_CONTROL - SSL for the control connection or fail 1061 CURLFTPSSL_ALL - SSL for all communication or fail 1062 */ 1063 use_ssl = 119, 1064 /** The _LARGE version of the standard POSTFIELDSIZE option */ 1065 postfieldsize_large = 30_120, 1066 /** Enable/disable the TCP Nagle algorithm */ 1067 tcp_nodelay = 121, 1068 /* 122 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1069 /* 123 OBSOLETE. Gone in 7.16.0 */ 1070 /* 124 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1071 /* 125 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1072 /* 126 OBSOLETE, used in 7.12.3. Gone in 7.13.0 */ 1073 /* 127 OBSOLETE. Gone in 7.16.0 */ 1074 /* 128 OBSOLETE. Gone in 7.16.0 */ 1075 1076 /** When FTP over SSL/TLS is selected (with CURLOPT_USE_SSL), this option 1077 can be used to change libcurl's default action which is to first try 1078 "AUTH SSL" and then "AUTH TLS" in this order, and proceed when a OK 1079 response has been received. 1080 1081 Available parameters are: 1082 CURLFTPAUTH_DEFAULT - let libcurl decide 1083 CURLFTPAUTH_SSL - try "AUTH SSL" first, then TLS 1084 CURLFTPAUTH_TLS - try "AUTH TLS" first, then SSL 1085 */ 1086 ftpsslauth = 129, 1087 ioctlfunction = 20_130, /// 1088 ioctldata = 10_131, /// 1089 /* 132 OBSOLETE. Gone in 7.16.0 */ 1090 /* 133 OBSOLETE. Gone in 7.16.0 */ 1091 1092 /** zero terminated string for pass on to the FTP server when asked for 1093 "account" info */ 1094 ftp_account = 10_134, 1095 /** feed cookies into cookie engine */ 1096 cookielist, 1097 /** ignore Content-Length */ 1098 ignore_content_length = 136, 1099 /** Set to non-zero to skip the IP address received in a 227 PASV FTP server 1100 response. Typically used for FTP-SSL purposes but is not restricted to 1101 that. libcurl will then instead use the same IP address it used for the 1102 control connection. */ 1103 ftp_skip_pasv_ip, 1104 /** Select "file method" to use when doing FTP, see the curl_ftpmethod 1105 above. */ 1106 ftp_filemethod, 1107 /** Local port number to bind the socket to */ 1108 localport, 1109 /** Number of ports to try, including the first one set with LOCALPORT. 1110 Thus, setting it to 1 will make no additional attempts but the first. 1111 */ 1112 localportrange, 1113 /** no transfer, set up connection and let application use the socket by 1114 extracting it with CURLINFO_LASTSOCKET */ 1115 connect_only, 1116 /** Function that will be called to convert from the 1117 network encoding (instead of using the iconv calls in libcurl) */ 1118 conv_from_network_function = 20_142, 1119 /** Function that will be called to convert to the 1120 network encoding (instead of using the iconv calls in libcurl) */ 1121 conv_to_network_function, 1122 /** Function that will be called to convert from UTF8 1123 (instead of using the iconv calls in libcurl) 1124 Note that this is used only for SSL certificate processing */ 1125 conv_from_utf8_function, 1126 /** If the connection proceeds too quickly then need to slow it down */ 1127 /** */ 1128 /** limit-rate: maximum number of bytes per second to send or receive */ 1129 max_send_speed_large = 30_145, 1130 max_recv_speed_large, /// ditto 1131 /** Pointer to command string to send if USER/PASS fails. */ 1132 ftp_alternative_to_user = 10_147, 1133 /** callback function for setting socket options */ 1134 sockoptfunction = 20_148, 1135 sockoptdata = 10_149, 1136 /** set to 0 to disable session ID re-use for this transfer, default is 1137 enabled (== 1) */ 1138 ssl_sessionid_cache = 150, 1139 /** allowed SSH authentication methods */ 1140 ssh_auth_types, 1141 /** Used by scp/sftp to do public/private key authentication */ 1142 ssh_public_keyfile = 10_152, 1143 ssh_private_keyfile, 1144 /** Send CCC (Clear Command Channel) after authentication */ 1145 ftp_ssl_ccc = 154, 1146 /** Same as TIMEOUT and CONNECTTIMEOUT, but with ms resolution */ 1147 timeout_ms, 1148 connecttimeout_ms, /// ditto 1149 /** set to zero to disable the libcurl's decoding and thus pass the raw body 1150 data to the application even when it is encoded/compressed */ 1151 http_transfer_decoding, 1152 http_content_decoding, /// ditto 1153 /** Permission used when creating new files and directories on the remote 1154 server for protocols that support it, SFTP/SCP/FILE */ 1155 new_file_perms, 1156 new_directory_perms, /// ditto 1157 /** Set the behaviour of POST when redirecting. Values must be set to one 1158 of CURL_REDIR* defines below. This used to be called CURLOPT_POST301 */ 1159 postredir, 1160 /** used by scp/sftp to verify the host's public key */ 1161 ssh_host_public_key_md5 = 10_162, 1162 /** Callback function for opening socket (instead of socket(2)). Optionally, 1163 callback is able change the address or refuse to connect returning 1164 CURL_SOCKET_BAD. The callback should have type 1165 curl_opensocket_callback */ 1166 opensocketfunction = 20_163, 1167 opensocketdata = 10_164, /// ditto 1168 /** POST volatile input fields. */ 1169 copypostfields, 1170 /** set transfer mode (;type=$(LT)a|i$(GT)) when doing FTP via an HTTP proxy */ 1171 proxy_transfer_mode = 166, 1172 /** Callback function for seeking in the input stream */ 1173 seekfunction = 20_167, 1174 seekdata = 10_168, /// ditto 1175 /** CRL file */ 1176 crlfile, 1177 /** Issuer certificate */ 1178 issuercert, 1179 /** (IPv6) Address scope */ 1180 address_scope = 171, 1181 /** Collect certificate chain info and allow it to get retrievable with 1182 CURLINFO_CERTINFO after the transfer is complete. (Unfortunately) only 1183 working with OpenSSL-powered builds. */ 1184 certinfo, 1185 /** "name" and "pwd" to use when fetching. */ 1186 username = 10_173, 1187 password, /// ditto 1188 /** "name" and "pwd" to use with Proxy when fetching. */ 1189 proxyusername, 1190 proxypassword, /// ditto 1191 /** Comma separated list of hostnames defining no-proxy zones. These should 1192 match both hostnames directly, and hostnames within a domain. For 1193 example, local.com will match local.com and www.local.com, but NOT 1194 notlocal.com or www.notlocal.com. For compatibility with other 1195 implementations of this, .local.com will be considered to be the same as 1196 local.com. A single * is the only valid wildcard, and effectively 1197 disables the use of proxy. */ 1198 noproxy, 1199 /** block size for TFTP transfers */ 1200 tftp_blksize = 178, 1201 /** Socks Service */ 1202 socks5_gssapi_service = 10_179, 1203 /** Socks Service */ 1204 socks5_gssapi_nec = 180, 1205 /** set the bitmask for the protocols that are allowed to be used for the 1206 transfer, which thus helps the app which takes URLs from users or other 1207 external inputs and want to restrict what protocol(s) to deal 1208 with. Defaults to CURLPROTO_ALL. */ 1209 protocols, 1210 /** set the bitmask for the protocols that libcurl is allowed to follow to, 1211 as a subset of the CURLOPT_PROTOCOLS ones. That means the protocol needs 1212 to be set in both bitmasks to be allowed to get redirected to. Defaults 1213 to all protocols except FILE and SCP. */ 1214 redir_protocols, 1215 /** set the SSH knownhost file name to use */ 1216 ssh_knownhosts = 10_183, 1217 /** set the SSH host key callback, must point to a curl_sshkeycallback 1218 function */ 1219 ssh_keyfunction = 20_184, 1220 /** set the SSH host key callback custom pointer */ 1221 ssh_keydata = 10_185, 1222 /** set the SMTP mail originator */ 1223 mail_from, 1224 /** set the SMTP mail receiver(s) */ 1225 mail_rcpt, 1226 /** FTP: send PRET before PASV */ 1227 ftp_use_pret = 188, 1228 /** RTSP request method (OPTIONS, SETUP, PLAY, etc...) */ 1229 rtsp_request, 1230 /** The RTSP session identifier */ 1231 rtsp_session_id = 10_190, 1232 /** The RTSP stream URI */ 1233 rtsp_stream_uri, 1234 /** The Transport: header to use in RTSP requests */ 1235 rtsp_transport, 1236 /** Manually initialize the client RTSP CSeq for this handle */ 1237 rtsp_client_cseq = 193, 1238 /** Manually initialize the server RTSP CSeq for this handle */ 1239 rtsp_server_cseq, 1240 /** The stream to pass to INTERLEAVEFUNCTION. */ 1241 interleavedata = 10_195, 1242 /** Let the application define a custom write method for RTP data */ 1243 interleavefunction = 20_196, 1244 /** Turn on wildcard matching */ 1245 wildcardmatch = 197, 1246 /** Directory matching callback called before downloading of an 1247 individual file (chunk) started */ 1248 chunk_bgn_function = 20_198, 1249 /** Directory matching callback called after the file (chunk) 1250 was downloaded, or skipped */ 1251 chunk_end_function, 1252 /** Change match (fnmatch-like) callback for wildcard matching */ 1253 fnmatch_function, 1254 /** Let the application define custom chunk data pointer */ 1255 chunk_data = 10_201, 1256 /** FNMATCH_FUNCTION user pointer */ 1257 fnmatch_data, 1258 /** send linked-list of name:port:address sets */ 1259 resolve, 1260 /** Set a username for authenticated TLS */ 1261 tlsauth_username, 1262 /** Set a password for authenticated TLS */ 1263 tlsauth_password, 1264 /** Set authentication type for authenticated TLS */ 1265 tlsauth_type, 1266 /** the last unused */ 1267 lastentry, 1268 1269 writedata = file, /// convenient alias 1270 readdata = infile, /// ditto 1271 headerdata = writeheader, /// ditto 1272 rtspheader = httpheader, /// ditto 1273 } 1274 /// 1275 alias CURLoption = int; 1276 /// 1277 enum CURLOPT_SERVER_RESPONSE_TIMEOUT = CurlOption.ftp_response_timeout; 1278 1279 /** Below here follows defines for the CURLOPT_IPRESOLVE option. If a host 1280 name resolves addresses using more than one IP protocol version, this 1281 option might be handy to force libcurl to use a specific IP version. */ 1282 enum CurlIpResolve { 1283 whatever = 0, /** default, resolves addresses to all IP versions that your system allows */ 1284 v4 = 1, /** resolve to ipv4 addresses */ 1285 v6 = 2 /** resolve to ipv6 addresses */ 1286 } 1287 1288 /** three convenient "aliases" that follow the name scheme better */ 1289 enum CURLOPT_WRITEDATA = CurlOption.file; 1290 /// ditto 1291 enum CURLOPT_READDATA = CurlOption.infile; 1292 /// ditto 1293 enum CURLOPT_HEADERDATA = CurlOption.writeheader; 1294 /// ditto 1295 enum CURLOPT_RTSPHEADER = CurlOption.httpheader; 1296 1297 /** These enums are for use with the CURLOPT_HTTP_VERSION option. */ 1298 enum CurlHttpVersion { 1299 none, /** setting this means we don't care, and that we'd 1300 like the library to choose the best possible 1301 for us! */ 1302 v1_0, /** please use HTTP 1.0 in the request */ 1303 v1_1, /** please use HTTP 1.1 in the request */ 1304 last /** *ILLEGAL* http version */ 1305 } 1306 1307 /** 1308 * Public API enums for RTSP requests 1309 */ 1310 enum CurlRtspReq { 1311 none, /// 1312 options, /// 1313 describe, /// 1314 announce, /// 1315 setup, /// 1316 play, /// 1317 pause, /// 1318 teardown, /// 1319 get_parameter, /// 1320 set_parameter, /// 1321 record, /// 1322 receive, /// 1323 last /// 1324 } 1325 1326 /** These enums are for use with the CURLOPT_NETRC option. */ 1327 enum CurlNetRcOption { 1328 ignored, /** The .netrc will never be read. This is the default. */ 1329 optional /** A user:password in the URL will be preferred to one in the .netrc. */, 1330 required, /** A user:password in the URL will be ignored. 1331 * Unless one is set programmatically, the .netrc 1332 * will be queried. */ 1333 last /// 1334 } 1335 1336 /// 1337 enum CurlSslVersion { 1338 default_version, /// 1339 tlsv1, /// 1340 sslv2, /// 1341 sslv3, /// 1342 last /** never use */ 1343 } 1344 1345 /// 1346 enum CurlTlsAuth { 1347 none, /// 1348 srp, /// 1349 last /** never use */ 1350 } 1351 1352 /** symbols to use with CURLOPT_POSTREDIR. 1353 CURL_REDIR_POST_301 and CURL_REDIR_POST_302 can be bitwise ORed so that 1354 CURL_REDIR_POST_301 | CURL_REDIR_POST_302 == CURL_REDIR_POST_ALL */ 1355 enum CurlRedir { 1356 get_all = 0, /// 1357 post_301 = 1, /// 1358 post_302 = 2, /// 1359 /// 1360 post_all = (1 | 2) // (CURL_REDIR_POST_301|CURL_REDIR_POST_302); 1361 } 1362 /// 1363 enum CurlTimeCond { 1364 none, /// 1365 ifmodsince, /// 1366 ifunmodsince, /// 1367 lastmod, /// 1368 last /// 1369 } 1370 /// 1371 alias curl_TimeCond = int; 1372 1373 1374 /** curl_strequal() and curl_strnequal() are subject for removal in a future 1375 libcurl, see lib/README.curlx for details */ 1376 extern (C) { 1377 int curl_strequal(scope const(char) *s1, scope const(char) *s2); 1378 /// ditto 1379 int curl_strnequal(scope const(char) *s1, scope const(char) *s2, size_t n); 1380 } 1381 enum CurlForm { 1382 nothing, /********** the first one is unused ************/ 1383 copyname, 1384 ptrname, 1385 namelength, 1386 copycontents, 1387 ptrcontents, 1388 contentslength, 1389 filecontent, 1390 array, 1391 obsolete, 1392 file, 1393 buffer, 1394 bufferptr, 1395 bufferlength, 1396 contenttype, 1397 contentheader, 1398 filename, 1399 end, 1400 obsolete2, 1401 stream, 1402 lastentry /** the last unused */ 1403 } 1404 alias CURLformoption = int; 1405 1406 1407 /** structure to be used as parameter for CURLFORM_ARRAY */ 1408 extern (C) struct curl_forms 1409 { 1410 CURLformoption option; /// 1411 const(char) *value; /// 1412 } 1413 1414 /** Use this for multipart formpost building 1415 * 1416 * Returns code for curl_formadd() 1417 * 1418 * Returns: 1419 * 1420 * $(UL 1421 * $(LI CURL_FORMADD_OK on success ) 1422 * $(LI CURL_FORMADD_MEMORY if the FormInfo allocation fails ) 1423 * $(LI CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form ) 1424 * $(LI CURL_FORMADD_NULL if a null pointer was given for a char ) 1425 * $(LI CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed ) 1426 * $(LI CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used ) 1427 * $(LI CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error) ) 1428 * $(LI CURL_FORMADD_MEMORY if a curl_httppost struct cannot be allocated ) 1429 * $(LI CURL_FORMADD_MEMORY if some allocation for string copying failed. ) 1430 * $(LI CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array ) 1431 * ) 1432 * 1433 ***************************************************************************/ 1434 enum CurlFormAdd { 1435 ok, /** first, no error */ 1436 memory, /// 1437 option_twice, /// 1438 null_ptr, /// 1439 unknown_option, /// 1440 incomplete, /// 1441 illegal_array, /// 1442 disabled, /** libcurl was built with this disabled */ 1443 last /// 1444 } 1445 /// 1446 alias CURLFORMcode = int; 1447 1448 extern (C) { 1449 1450 /** 1451 * Name: curl_formadd() 1452 * 1453 * Description: 1454 * 1455 * Pretty advanced function for building multi-part formposts. Each invoke 1456 * adds one part that together construct a full post. Then use 1457 * CURLOPT_HTTPPOST to send it off to libcurl. 1458 */ 1459 CURLFORMcode curl_formadd(curl_httppost **httppost, curl_httppost **last_post,...); 1460 1461 /** 1462 * callback function for curl_formget() 1463 * The void *arg pointer will be the one passed as second argument to 1464 * curl_formget(). 1465 * The character buffer passed to it must not be freed. 1466 * Should return the buffer length passed to it as the argument "len" on 1467 * success. 1468 */ 1469 alias curl_formget_callback = size_t function(void *arg, const(char) *buf, size_t len); 1470 1471 /** 1472 * Name: curl_formget() 1473 * 1474 * Description: 1475 * 1476 * Serialize a curl_httppost struct built with curl_formadd(). 1477 * Accepts a void pointer as second argument which will be passed to 1478 * the curl_formget_callback function. 1479 * Returns 0 on success. 1480 */ 1481 int curl_formget(curl_httppost *form, void *arg, curl_formget_callback append); 1482 /** 1483 * Name: curl_formfree() 1484 * 1485 * Description: 1486 * 1487 * Free a multipart formpost previously built with curl_formadd(). 1488 */ 1489 void curl_formfree(curl_httppost *form); 1490 1491 /** 1492 * Name: curl_getenv() 1493 * 1494 * Description: 1495 * 1496 * Returns a malloc()'ed string that MUST be curl_free()ed after usage is 1497 * complete. DEPRECATED - see lib/README.curlx 1498 */ 1499 char * curl_getenv(scope const(char) *variable); 1500 1501 /** 1502 * Name: curl_version() 1503 * 1504 * Description: 1505 * 1506 * Returns a static ascii string of the libcurl version. 1507 */ 1508 char * curl_version(); 1509 1510 /** 1511 * Name: curl_easy_escape() 1512 * 1513 * Description: 1514 * 1515 * Escapes URL strings (converts all letters consider illegal in URLs to their 1516 * %XX versions). This function returns a new allocated string or NULL if an 1517 * error occurred. 1518 */ 1519 char * curl_easy_escape(CURL *handle, scope const(char) *string, int length); 1520 1521 /** the previous version: */ 1522 char * curl_escape(scope const(char) *string, int length); 1523 1524 1525 /** 1526 * Name: curl_easy_unescape() 1527 * 1528 * Description: 1529 * 1530 * Unescapes URL encoding in strings (converts all %XX codes to their 8bit 1531 * versions). This function returns a new allocated string or NULL if an error 1532 * occurred. 1533 * Conversion Note: On non-ASCII platforms the ASCII %XX codes are 1534 * converted into the host encoding. 1535 */ 1536 char * curl_easy_unescape(CURL *handle, scope const(char) *string, int length, int *outlength); 1537 1538 /** the previous version */ 1539 char * curl_unescape(scope const(char) *string, int length); 1540 1541 /** 1542 * Name: curl_free() 1543 * 1544 * Description: 1545 * 1546 * Provided for de-allocation in the same translation unit that did the 1547 * allocation. Added in libcurl 7.10 1548 */ 1549 void curl_free(void *p); 1550 1551 /** 1552 * Name: curl_global_init() 1553 * 1554 * Description: 1555 * 1556 * curl_global_init() should be invoked exactly once for each application that 1557 * uses libcurl and before any call of other libcurl functions. 1558 * 1559 * This function is not thread-safe! 1560 */ 1561 CURLcode curl_global_init(c_long flags); 1562 1563 /** 1564 * Name: curl_global_init_mem() 1565 * 1566 * Description: 1567 * 1568 * curl_global_init() or curl_global_init_mem() should be invoked exactly once 1569 * for each application that uses libcurl. This function can be used to 1570 * initialize libcurl and set user defined memory management callback 1571 * functions. Users can implement memory management routines to check for 1572 * memory leaks, check for mis-use of the curl library etc. User registered 1573 * callback routines with be invoked by this library instead of the system 1574 * memory management routines like malloc, free etc. 1575 */ 1576 CURLcode curl_global_init_mem( 1577 c_long flags, 1578 curl_malloc_callback m, 1579 curl_free_callback f, 1580 curl_realloc_callback r, 1581 curl_strdup_callback s, 1582 curl_calloc_callback c 1583 ); 1584 1585 /** 1586 * Name: curl_global_cleanup() 1587 * 1588 * Description: 1589 * 1590 * curl_global_cleanup() should be invoked exactly once for each application 1591 * that uses libcurl 1592 */ 1593 void curl_global_cleanup(); 1594 } 1595 1596 /** linked-list structure for the CURLOPT_QUOTE option (and other) */ 1597 extern (C) { 1598 1599 struct curl_slist 1600 { 1601 char *data; 1602 curl_slist *next; 1603 } 1604 1605 /** 1606 * Name: curl_slist_append() 1607 * 1608 * Description: 1609 * 1610 * Appends a string to a linked list. If no list exists, it will be created 1611 * first. Returns the new list, after appending. 1612 */ 1613 curl_slist * curl_slist_append(curl_slist *, const(char) *); 1614 1615 /** 1616 * Name: curl_slist_free_all() 1617 * 1618 * Description: 1619 * 1620 * free a previously built curl_slist. 1621 */ 1622 void curl_slist_free_all(curl_slist *); 1623 1624 /** 1625 * Name: curl_getdate() 1626 * 1627 * Description: 1628 * 1629 * Returns the time, in seconds since 1 Jan 1970 of the time string given in 1630 * the first argument. The time argument in the second parameter is unused 1631 * and should be set to NULL. 1632 */ 1633 time_t curl_getdate(const(char) *p, const(time_t) *unused); 1634 1635 /** info about the certificate chain, only for OpenSSL builds. Asked 1636 for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */ 1637 struct curl_certinfo 1638 { 1639 int num_of_certs; /** number of certificates with information */ 1640 curl_slist **certinfo; /** for each index in this array, there's a 1641 linked list with textual information in the 1642 format "name: value" */ 1643 } 1644 1645 } // extern (C) end 1646 1647 /// 1648 enum CURLINFO_STRING = 0x100000; 1649 /// 1650 enum CURLINFO_LONG = 0x200000; 1651 /// 1652 enum CURLINFO_DOUBLE = 0x300000; 1653 /// 1654 enum CURLINFO_SLIST = 0x400000; 1655 /// 1656 enum CURLINFO_MASK = 0x0fffff; 1657 1658 /// 1659 enum CURLINFO_TYPEMASK = 0xf00000; 1660 1661 /// 1662 enum CurlInfo { 1663 none, /// 1664 effective_url = 1_048_577, /// 1665 response_code = 2_097_154, /// 1666 total_time = 3_145_731, /// 1667 namelookup_time, /// 1668 connect_time, /// 1669 pretransfer_time, /// 1670 size_upload, /// 1671 size_download, /// 1672 speed_download, /// 1673 speed_upload, /// 1674 header_size = 2_097_163, /// 1675 request_size, /// 1676 ssl_verifyresult, /// 1677 filetime, /// 1678 content_length_download = 3_145_743, /// 1679 content_length_upload, /// 1680 starttransfer_time, /// 1681 content_type = 1_048_594, /// 1682 redirect_time = 3_145_747, /// 1683 redirect_count = 2_097_172, /// 1684 private_info = 1_048_597, /// 1685 http_connectcode = 2_097_174, /// 1686 httpauth_avail, /// 1687 proxyauth_avail, /// 1688 os_errno, /// 1689 num_connects, /// 1690 ssl_engines = 4_194_331, /// 1691 cookielist, /// 1692 lastsocket = 2_097_181, /// 1693 ftp_entry_path = 1_048_606, /// 1694 redirect_url, /// 1695 primary_ip, /// 1696 appconnect_time = 3_145_761, /// 1697 certinfo = 4_194_338, /// 1698 condition_unmet = 2_097_187, /// 1699 rtsp_session_id = 1_048_612, /// 1700 rtsp_client_cseq = 2_097_189, /// 1701 rtsp_server_cseq, /// 1702 rtsp_cseq_recv, /// 1703 primary_port, /// 1704 local_ip = 1_048_617, /// 1705 local_port = 2_097_194, /// 1706 /** Fill in new entries below here! */ 1707 lastone = 42 1708 } 1709 /// 1710 alias CURLINFO = int; 1711 1712 /** CURLINFO_RESPONSE_CODE is the new name for the option previously known as 1713 CURLINFO_HTTP_CODE */ 1714 enum CURLINFO_HTTP_CODE = CurlInfo.response_code; 1715 1716 /// 1717 enum CurlClosePolicy { 1718 none, /// 1719 oldest, /// 1720 least_recently_used, /// 1721 least_traffic, /// 1722 slowest, /// 1723 callback, /// 1724 last /// 1725 } 1726 /// 1727 alias curl_closepolicy = int; 1728 1729 /// 1730 enum CurlGlobal { 1731 ssl = 1, /// 1732 win32 = 2, /// 1733 /// 1734 all = (1 | 2), // (CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32); 1735 nothing = 0, /// 1736 default_ = (1 | 2) /// all 1737 } 1738 1739 /****************************************************************************** 1740 * Setup defines, protos etc for the sharing stuff. 1741 */ 1742 1743 /** Different data locks for a single share */ 1744 enum CurlLockData { 1745 none, /// 1746 /** CURL_LOCK_DATA_SHARE is used internally to say that 1747 * the locking is just made to change the internal state of the share 1748 * itself. 1749 */ 1750 share, 1751 cookie, /// 1752 dns, /// 1753 ssl_session, /// 1754 connect, /// 1755 last /// 1756 } 1757 /// 1758 alias curl_lock_data = int; 1759 1760 /** Different lock access types */ 1761 enum CurlLockAccess { 1762 none, /** unspecified action */ 1763 shared_access, /** for read perhaps */ 1764 single, /** for write perhaps */ 1765 last /** never use */ 1766 } 1767 /// 1768 alias curl_lock_access = int; 1769 1770 /// 1771 alias curl_lock_function = void function(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr); 1772 /// 1773 alias curl_unlock_function = void function(CURL *handle, curl_lock_data data, void *userptr); 1774 1775 /// 1776 alias CURLSH = void; 1777 1778 /// 1779 enum CurlShError { 1780 ok, /** all is fine */ 1781 bad_option, /** 1 */ 1782 in_use, /** 2 */ 1783 invalid, /** 3 */ 1784 nomem, /** out of memory */ 1785 last /** never use */ 1786 } 1787 /// 1788 alias CURLSHcode = int; 1789 1790 /** pass in a user data pointer used in the lock/unlock callback 1791 functions */ 1792 enum CurlShOption { 1793 none, /** don't use */ 1794 share, /** specify a data type to share */ 1795 unshare, /** specify which data type to stop sharing */ 1796 lockfunc, /** pass in a 'curl_lock_function' pointer */ 1797 unlockfunc, /** pass in a 'curl_unlock_function' pointer */ 1798 userdata, /** pass in a user data pointer used in the lock/unlock 1799 callback functions */ 1800 last /** never use */ 1801 } 1802 /// 1803 alias CURLSHoption = int; 1804 1805 extern (C) { 1806 /// 1807 CURLSH * curl_share_init(); 1808 /// 1809 CURLSHcode curl_share_setopt(CURLSH *, CURLSHoption option,...); 1810 /// 1811 CURLSHcode curl_share_cleanup(CURLSH *); 1812 } 1813 1814 /***************************************************************************** 1815 * Structures for querying information about the curl library at runtime. 1816 */ 1817 1818 // CURLVERSION_* 1819 enum CurlVer { 1820 first, /// 1821 second, /// 1822 third, /// 1823 fourth, /// 1824 last /// 1825 } 1826 /// 1827 alias CURLversion = int; 1828 1829 /** The 'CURLVERSION_NOW' is the symbolic name meant to be used by 1830 basically all programs ever that want to get version information. It is 1831 meant to be a built-in version number for what kind of struct the caller 1832 expects. If the struct ever changes, we redefine the NOW to another enum 1833 from above. */ 1834 enum CURLVERSION_NOW = CurlVer.fourth; 1835 1836 /// 1837 extern (C) struct _N28 1838 { 1839 CURLversion age; /** age of the returned struct */ 1840 const(char) *version_; /** LIBCURL_VERSION */ 1841 uint version_num; /** LIBCURL_VERSION_NUM */ 1842 const(char) *host; /** OS/host/cpu/machine when configured */ 1843 int features; /** bitmask, see defines below */ 1844 const(char) *ssl_version; /** human readable string */ 1845 c_long ssl_version_num; /** not used anymore, always 0 */ 1846 const(char) *libz_version; /** human readable string */ 1847 /** protocols is terminated by an entry with a NULL protoname */ 1848 const(char) **protocols; 1849 /** The fields below this were added in CURLVERSION_SECOND */ 1850 const(char) *ares; 1851 int ares_num; 1852 /** This field was added in CURLVERSION_THIRD */ 1853 const(char) *libidn; 1854 /** These field were added in CURLVERSION_FOURTH. */ 1855 /** Same as '_libiconv_version' if built with HAVE_ICONV */ 1856 int iconv_ver_num; 1857 const(char) *libssh_version; /** human readable string */ 1858 } 1859 /// 1860 alias curl_version_info_data = _N28; 1861 1862 /// 1863 // CURL_VERSION_* 1864 enum CurlVersion { 1865 ipv6 = 1, /** IPv6-enabled */ 1866 kerberos4 = 2, /** kerberos auth is supported */ 1867 ssl = 4, /** SSL options are present */ 1868 libz = 8, /** libz features are present */ 1869 ntlm = 16, /** NTLM auth is supported */ 1870 gssnegotiate = 32, /** Negotiate auth support */ 1871 dbg = 64, /** built with debug capabilities */ 1872 asynchdns = 128, /** asynchronous dns resolves */ 1873 spnego = 256, /** SPNEGO auth */ 1874 largefile = 512, /** supports files bigger than 2GB */ 1875 idn = 1024, /** International Domain Names support */ 1876 sspi = 2048, /** SSPI is supported */ 1877 conv = 4096, /** character conversions supported */ 1878 curldebug = 8192, /** debug memory tracking supported */ 1879 tlsauth_srp = 16_384 /** TLS-SRP auth is supported */ 1880 } 1881 1882 extern (C) { 1883 /** 1884 * Name: curl_version_info() 1885 * 1886 * Description: 1887 * 1888 * This function returns a pointer to a static copy of the version info 1889 * struct. See above. 1890 */ 1891 curl_version_info_data * curl_version_info(CURLversion ); 1892 1893 /** 1894 * Name: curl_easy_strerror() 1895 * 1896 * Description: 1897 * 1898 * The curl_easy_strerror function may be used to turn a CURLcode value 1899 * into the equivalent human readable error string. This is useful 1900 * for printing meaningful error messages. 1901 */ 1902 const(char)* curl_easy_strerror(CURLcode ); 1903 1904 /** 1905 * Name: curl_share_strerror() 1906 * 1907 * Description: 1908 * 1909 * The curl_share_strerror function may be used to turn a CURLSHcode value 1910 * into the equivalent human readable error string. This is useful 1911 * for printing meaningful error messages. 1912 */ 1913 const(char)* curl_share_strerror(CURLSHcode ); 1914 1915 /** 1916 * Name: curl_easy_pause() 1917 * 1918 * Description: 1919 * 1920 * The curl_easy_pause function pauses or unpauses transfers. Select the new 1921 * state by setting the bitmask, use the convenience defines below. 1922 * 1923 */ 1924 CURLcode curl_easy_pause(CURL *handle, int bitmask); 1925 } 1926 1927 1928 /// 1929 enum CurlPause { 1930 recv = 1, /// 1931 recv_cont = 0, /// 1932 send = 4, /// 1933 send_cont = 0, /// 1934 /// 1935 all = (1 | 4), // CURLPAUSE_RECV | CURLPAUSE_SEND 1936 /// 1937 cont = (0 | 0), // CURLPAUSE_RECV_CONT | CURLPAUSE_SEND_CONT 1938 } 1939 1940 /* unfortunately, the easy.h and multi.h include files need options and info 1941 stuff before they can be included! */ 1942 /* *************************************************************************** 1943 * _ _ ____ _ 1944 * Project ___| | | | _ \| | 1945 * / __| | | | |_) | | 1946 * | (__| |_| | _ <| |___ 1947 * \___|\___/|_| \_\_____| 1948 * 1949 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. 1950 * 1951 * This software is licensed as described in the file COPYING, which 1952 * you should have received as part of this distribution. The terms 1953 * are also available at http://curl.haxx.se/docs/copyright.html. 1954 * 1955 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 1956 * copies of the Software, and permit persons to whom the Software is 1957 * furnished to do so, under the terms of the COPYING file. 1958 * 1959 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 1960 * KIND, either express or implied. 1961 * 1962 ***************************************************************************/ 1963 1964 extern (C) { 1965 /// 1966 CURL * curl_easy_init(); 1967 /// 1968 CURLcode curl_easy_setopt(CURL *curl, CURLoption option,...); 1969 /// 1970 CURLcode curl_easy_perform(CURL *curl); 1971 /// 1972 void curl_easy_cleanup(CURL *curl); 1973 } 1974 1975 /** 1976 * Name: curl_easy_getinfo() 1977 * 1978 * Description: 1979 * 1980 * Request internal information from the curl session with this function. The 1981 * third argument MUST be a pointer to a long, a pointer to a char * or a 1982 * pointer to a double (as the documentation describes elsewhere). The data 1983 * pointed to will be filled in accordingly and can be relied upon only if the 1984 * function returns CURLE_OK. This function is intended to get used *AFTER* a 1985 * performed transfer, all results from this function are undefined until the 1986 * transfer is completed. 1987 */ 1988 extern (C) CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info,...); 1989 1990 1991 /** 1992 * Name: curl_easy_duphandle() 1993 * 1994 * Description: 1995 * 1996 * Creates a new curl session handle with the same options set for the handle 1997 * passed in. Duplicating a handle could only be a matter of cloning data and 1998 * options, internal state info and things like persistant connections cannot 1999 * be transfered. It is useful in multithreaded applications when you can run 2000 * curl_easy_duphandle() for each new thread to avoid a series of identical 2001 * curl_easy_setopt() invokes in every thread. 2002 */ 2003 extern (C) CURL * curl_easy_duphandle(CURL *curl); 2004 2005 /** 2006 * Name: curl_easy_reset() 2007 * 2008 * Description: 2009 * 2010 * Re-initializes a CURL handle to the default values. This puts back the 2011 * handle to the same state as it was in when it was just created. 2012 * 2013 * It does keep: live connections, the Session ID cache, the DNS cache and the 2014 * cookies. 2015 */ 2016 extern (C) void curl_easy_reset(CURL *curl); 2017 2018 /** 2019 * Name: curl_easy_recv() 2020 * 2021 * Description: 2022 * 2023 * Receives data from the connected socket. Use after successful 2024 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 2025 */ 2026 extern (C) CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen, size_t *n); 2027 2028 /** 2029 * Name: curl_easy_send() 2030 * 2031 * Description: 2032 * 2033 * Sends data over the connected socket. Use after successful 2034 * curl_easy_perform() with CURLOPT_CONNECT_ONLY option. 2035 */ 2036 extern (C) CURLcode curl_easy_send(CURL *curl, void *buffer, size_t buflen, size_t *n); 2037 2038 2039 /* 2040 * This header file should not really need to include "curl.h" since curl.h 2041 * itself includes this file and we expect user applications to do #include 2042 * <curl/curl.h> without the need for especially including multi.h. 2043 * 2044 * For some reason we added this include here at one point, and rather than to 2045 * break existing (wrongly written) libcurl applications, we leave it as-is 2046 * but with this warning attached. 2047 */ 2048 /* *************************************************************************** 2049 * _ _ ____ _ 2050 * Project ___| | | | _ \| | 2051 * / __| | | | |_) | | 2052 * | (__| |_| | _ <| |___ 2053 * \___|\___/|_| \_\_____| 2054 * 2055 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. 2056 * 2057 * This software is licensed as described in the file COPYING, which 2058 * you should have received as part of this distribution. The terms 2059 * are also available at http://curl.haxx.se/docs/copyright.html. 2060 * 2061 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 2062 * copies of the Software, and permit persons to whom the Software is 2063 * furnished to do so, under the terms of the COPYING file. 2064 * 2065 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 2066 * KIND, either express or implied. 2067 * 2068 ***************************************************************************/ 2069 2070 /// 2071 alias CURLM = void; 2072 2073 /// 2074 enum CurlM { 2075 call_multi_perform = -1, /** please call curl_multi_perform() or curl_multi_socket*() soon */ 2076 ok, /// 2077 bad_handle, /** the passed-in handle is not a valid CURLM handle */ 2078 bad_easy_handle, /** an easy handle was not good/valid */ 2079 out_of_memory, /** if you ever get this, you're in deep sh*t */ 2080 internal_error, /** this is a libcurl bug */ 2081 bad_socket, /** the passed in socket argument did not match */ 2082 unknown_option, /** curl_multi_setopt() with unsupported option */ 2083 last, /// 2084 } 2085 /// 2086 alias CURLMcode = int; 2087 2088 /** just to make code nicer when using curl_multi_socket() you can now check 2089 for CURLM_CALL_MULTI_SOCKET too in the same style it works for 2090 curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ 2091 enum CURLM_CALL_MULTI_SOCKET = CurlM.call_multi_perform; 2092 2093 /// 2094 enum CurlMsg 2095 { 2096 none, /// 2097 done, /** This easy handle has completed. 'result' contains 2098 the CURLcode of the transfer */ 2099 last, /** no used */ 2100 } 2101 /// 2102 alias CURLMSG = int; 2103 2104 /// 2105 extern (C) union _N31 2106 { 2107 void *whatever; /** message-specific data */ 2108 CURLcode result; /** return code for transfer */ 2109 } 2110 2111 /// 2112 extern (C) struct CURLMsg 2113 { 2114 CURLMSG msg; /** what this message means */ 2115 CURL *easy_handle; /** the handle it concerns */ 2116 _N31 data; /// 2117 } 2118 2119 /** 2120 * Name: curl_multi_init() 2121 * 2122 * Desc: inititalize multi-style curl usage 2123 * 2124 * Returns: a new CURLM handle to use in all 'curl_multi' functions. 2125 */ 2126 extern (C) CURLM * curl_multi_init(); 2127 2128 /** 2129 * Name: curl_multi_add_handle() 2130 * 2131 * Desc: add a standard curl handle to the multi stack 2132 * 2133 * Returns: CURLMcode type, general multi error code. 2134 */ 2135 extern (C) CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle); 2136 2137 /** 2138 * Name: curl_multi_remove_handle() 2139 * 2140 * Desc: removes a curl handle from the multi stack again 2141 * 2142 * Returns: CURLMcode type, general multi error code. 2143 */ 2144 extern (C) CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle); 2145 2146 /** 2147 * Name: curl_multi_fdset() 2148 * 2149 * Desc: Ask curl for its fd_set sets. The app can use these to select() or 2150 * poll() on. We want curl_multi_perform() called as soon as one of 2151 * them are ready. 2152 * 2153 * Returns: CURLMcode type, general multi error code. 2154 */ 2155 2156 /** tmp decl */ 2157 alias fd_set = int; 2158 /// 2159 extern (C) CURLMcode curl_multi_fdset( 2160 CURLM *multi_handle, 2161 fd_set *read_fd_set, 2162 fd_set *write_fd_set, 2163 fd_set *exc_fd_set, 2164 int *max_fd 2165 ); 2166 2167 /** 2168 * Name: curl_multi_perform() 2169 * 2170 * Desc: When the app thinks there's data available for curl it calls this 2171 * function to read/write whatever there is right now. This returns 2172 * as soon as the reads and writes are done. This function does not 2173 * require that there actually is data available for reading or that 2174 * data can be written, it can be called just in case. It returns 2175 * the number of handles that still transfer data in the second 2176 * argument's integer-pointer. 2177 * 2178 * Returns: CURLMcode type, general multi error code. *NOTE* that this only 2179 * returns errors etc regarding the whole multi stack. There might 2180 * still have occurred problems on invidual transfers even when this 2181 * returns OK. 2182 */ 2183 extern (C) CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); 2184 2185 /** 2186 * Name: curl_multi_cleanup() 2187 * 2188 * Desc: Cleans up and removes a whole multi stack. It does not free or 2189 * touch any individual easy handles in any way. We need to define 2190 * in what state those handles will be if this function is called 2191 * in the middle of a transfer. 2192 * 2193 * Returns: CURLMcode type, general multi error code. 2194 */ 2195 extern (C) CURLMcode curl_multi_cleanup(CURLM *multi_handle); 2196 2197 /** 2198 * Name: curl_multi_info_read() 2199 * 2200 * Desc: Ask the multi handle if there's any messages/informationals from 2201 * the individual transfers. Messages include informationals such as 2202 * error code from the transfer or just the fact that a transfer is 2203 * completed. More details on these should be written down as well. 2204 * 2205 * Repeated calls to this function will return a new struct each 2206 * time, until a special "end of msgs" struct is returned as a signal 2207 * that there is no more to get at this point. 2208 * 2209 * The data the returned pointer points to will not survive calling 2210 * curl_multi_cleanup(). 2211 * 2212 * The 'CURLMsg' struct is meant to be very simple and only contain 2213 * very basic informations. If more involved information is wanted, 2214 * we will provide the particular "transfer handle" in that struct 2215 * and that should/could/would be used in subsequent 2216 * curl_easy_getinfo() calls (or similar). The point being that we 2217 * must never expose complex structs to applications, as then we'll 2218 * undoubtably get backwards compatibility problems in the future. 2219 * 2220 * Returns: A pointer to a filled-in struct, or NULL if it failed or ran out 2221 * of structs. It also writes the number of messages left in the 2222 * queue (after this read) in the integer the second argument points 2223 * to. 2224 */ 2225 extern (C) CURLMsg * curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); 2226 2227 /** 2228 * Name: curl_multi_strerror() 2229 * 2230 * Desc: The curl_multi_strerror function may be used to turn a CURLMcode 2231 * value into the equivalent human readable error string. This is 2232 * useful for printing meaningful error messages. 2233 * 2234 * Returns: A pointer to a zero-terminated error message. 2235 */ 2236 extern (C) const(char)* curl_multi_strerror(CURLMcode ); 2237 2238 /** 2239 * Name: curl_multi_socket() and 2240 * curl_multi_socket_all() 2241 * 2242 * Desc: An alternative version of curl_multi_perform() that allows the 2243 * application to pass in one of the file descriptors that have been 2244 * detected to have "action" on them and let libcurl perform. 2245 * See man page for details. 2246 */ 2247 enum CurlPoll { 2248 none_ = 0, /** jdrewsen - underscored in order not to clash with reserved D symbols */ 2249 in_ = 1, /// 2250 out_ = 2, /// 2251 inout_ = 3, /// 2252 remove_ = 4 /// 2253 } 2254 2255 /// 2256 alias CURL_SOCKET_TIMEOUT = CURL_SOCKET_BAD; 2257 2258 /// 2259 enum CurlCSelect { 2260 in_ = 0x01, /** jdrewsen - underscored in order not to clash with reserved D symbols */ 2261 out_ = 0x02, /// 2262 err_ = 0x04 /// 2263 } 2264 2265 extern (C) { 2266 /// 2267 alias curl_socket_callback = 2268 int function(CURL *easy, /** easy handle */ 2269 curl_socket_t s, /** socket */ 2270 int what, /** see above */ 2271 void *userp, /** private callback pointer */ 2272 void *socketp); /** private socket pointer */ 2273 } 2274 2275 /** 2276 * Name: curl_multi_timer_callback 2277 * 2278 * Desc: Called by libcurl whenever the library detects a change in the 2279 * maximum number of milliseconds the app is allowed to wait before 2280 * curl_multi_socket() or curl_multi_perform() must be called 2281 * (to allow libcurl's timed events to take place). 2282 * 2283 * Returns: The callback should return zero. 2284 */ 2285 2286 extern (C) { 2287 alias curl_multi_timer_callback = 2288 int function(CURLM *multi, /** multi handle */ 2289 c_long timeout_ms, /** see above */ 2290 void *userp); /** private callback pointer */ 2291 /// ditto 2292 CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s, int *running_handles); 2293 /// ditto 2294 CURLMcode curl_multi_socket_action(CURLM *multi_handle, curl_socket_t s, int ev_bitmask, int *running_handles); 2295 /// ditto 2296 CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles); 2297 } 2298 2299 /** This macro below was added in 7.16.3 to push users who recompile to use 2300 the new curl_multi_socket_action() instead of the old curl_multi_socket() 2301 */ 2302 2303 /** 2304 * Name: curl_multi_timeout() 2305 * 2306 * Desc: Returns the maximum number of milliseconds the app is allowed to 2307 * wait before curl_multi_socket() or curl_multi_perform() must be 2308 * called (to allow libcurl's timed events to take place). 2309 * 2310 * Returns: CURLM error code. 2311 */ 2312 extern (C) CURLMcode curl_multi_timeout(CURLM *multi_handle, c_long *milliseconds); 2313 2314 /// 2315 enum CurlMOption { 2316 socketfunction = 20_001, /** This is the socket callback function pointer */ 2317 socketdata = 10_002, /** This is the argument passed to the socket callback */ 2318 pipelining = 3, /** set to 1 to enable pipelining for this multi handle */ 2319 timerfunction = 20_004, /** This is the timer callback function pointer */ 2320 timerdata = 10_005, /** This is the argument passed to the timer callback */ 2321 maxconnects = 6, /** maximum number of entries in the connection cache */ 2322 lastentry /// 2323 } 2324 /// 2325 alias CURLMoption = int; 2326 2327 /** 2328 * Name: curl_multi_setopt() 2329 * 2330 * Desc: Sets options for the multi handle. 2331 * 2332 * Returns: CURLM error code. 2333 */ 2334 extern (C) CURLMcode curl_multi_setopt(CURLM *multi_handle, CURLMoption option,...); 2335 2336 /** 2337 * Name: curl_multi_assign() 2338 * 2339 * Desc: This function sets an association in the multi handle between the 2340 * given socket and a private pointer of the application. This is 2341 * (only) useful for curl_multi_socket uses. 2342 * 2343 * Returns: CURLM error code. 2344 */ 2345 extern (C) CURLMcode curl_multi_assign(CURLM *multi_handle, curl_socket_t sockfd, void *sockp);