forked from ldc-developers/phobos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurl.d
2336 lines (2150 loc) · 81.1 KB
/
curl.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
This is an interface to the libcurl library.
Converted to D from curl headers by $(LINK2 http://www.digitalmars.com/d/2.0/htod.html, htod) and
cleaned up by Jonas Drewsen (jdrewsen)
Windows x86 note:
A DMD compatible libcurl static library can be downloaded from the dlang.org
$(LINK2 http://dlang.org/download.html, download page).
*/
/* **************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*/
/**
* Copyright (C) 1998 - 2010, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at $(LINK http://curl.haxx.se/docs/copyright.html).
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
module etc.c.curl;
import core.stdc.config;
import core.stdc.time;
import std.socket;
// linux
import core.sys.posix.sys.socket;
//
// LICENSE FROM CURL HEADERS
//
/** This is the global package copyright */
enum LIBCURL_COPYRIGHT = "1996 - 2010 Daniel Stenberg, <[email protected]>.";
/** This is the version number of the libcurl package from which this header
file origins: */
enum LIBCURL_VERSION = "7.21.4";
/** The numeric version number is also available "in parts" by using these
constants */
enum LIBCURL_VERSION_MAJOR = 7;
/// ditto
enum LIBCURL_VERSION_MINOR = 21;
/// ditto
enum LIBCURL_VERSION_PATCH = 4;
/** This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
always follow this syntax:
0xXXYYZZ
Where XX, YY and ZZ are the main version, release and patch numbers in
hexadecimal (using 8 bits each). All three numbers are always represented
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
appears as "0x090b07".
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
*/
enum LIBCURL_VERSION_NUM = 0x071504;
/**
* This is the date and time when the full source package was created. The
* timestamp is not stored in git, as the timestamp is properly set in the
* tarballs by the maketgz script.
*
* The format of the date should follow this template:
*
* "Mon Feb 12 11:35:33 UTC 2007"
*/
enum LIBCURL_TIMESTAMP = "Thu Feb 17 12:19:40 UTC 2011";
/** Data type definition of curl_off_t.
*
* jdrewsen - Always 64bit signed and that is what long is in D.
*
* Comment below is from curlbuild.h:
*
* NOTE 2:
*
* For any given platform/compiler curl_off_t must be typedef'ed to a
* 64-bit wide signed integral data type. The width of this data type
* must remain constant and independent of any possible large file
* support settings.
*
* As an exception to the above, curl_off_t shall be typedef'ed to a
* 32-bit wide signed integral data type if there is no 64-bit type.
*/
alias curl_off_t = long;
///
alias CURL = void;
/// jdrewsen - Get socket alias from std.socket
alias curl_socket_t = socket_t;
/// jdrewsen - Would like to get socket error constant from std.socket by it is private atm.
version(Windows)
{
import core.sys.windows.windows, core.sys.windows.winsock2;
enum CURL_SOCKET_BAD = SOCKET_ERROR;
}
version(Posix) enum CURL_SOCKET_BAD = -1;
///
extern (C) struct curl_httppost
{
curl_httppost *next; /** next entry in the list */
char *name; /** pointer to allocated name */
c_long namelength; /** length of name length */
char *contents; /** pointer to allocated data contents */
c_long contentslength; /** length of contents field */
char *buffer; /** pointer to allocated buffer contents */
c_long bufferlength; /** length of buffer field */
char *contenttype; /** Content-Type */
curl_slist *contentheader; /** list of extra headers for this form */
curl_httppost *more; /** if one field name has more than one
file, this link should link to following
files */
c_long flags; /** as defined below */
char *showfilename; /** The file name to show. If not set, the
actual file name will be used (if this
is a file part) */
void *userp; /** custom pointer used for
HTTPPOST_CALLBACK posts */
}
enum HTTPPOST_FILENAME = 1; /** specified content is a file name */
enum HTTPPOST_READFILE = 2; /** specified content is a file name */
enum HTTPPOST_PTRNAME = 4; /** name is only stored pointer
do not free in formfree */
enum HTTPPOST_PTRCONTENTS = 8; /** contents is only stored pointer
do not free in formfree */
enum HTTPPOST_BUFFER = 16; /** upload file from buffer */
enum HTTPPOST_PTRBUFFER = 32; /** upload file from pointer contents */
enum HTTPPOST_CALLBACK = 64; /** upload file contents by using the
regular read callback to get the data
and pass the given pointer as custom
pointer */
///
alias curl_progress_callback = int function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
/** Tests have proven that 20K is a very bad buffer size for uploads on
Windows, while 16K for some odd reason performed a lot better.
We do the ifndef check to allow this value to easier be changed at build
time for those who feel adventurous. The practical minimum is about
400 bytes since libcurl uses a buffer of this size as a scratch area
(unrelated to network send operations). */
enum CURL_MAX_WRITE_SIZE = 16_384;
/** The only reason to have a max limit for this is to avoid the risk of a bad
server feeding libcurl with a never-ending header that will cause reallocs
infinitely */
enum CURL_MAX_HTTP_HEADER = (100*1024);
/** This is a magic return code for the write callback that, when returned,
will signal libcurl to pause receiving on the current transfer. */
enum CURL_WRITEFUNC_PAUSE = 0x10000001;
///
alias curl_write_callback = size_t function(char *buffer, size_t size, size_t nitems, void *outstream);
/** enumeration of file types */
enum CurlFileType {
file, ///
directory, ///
symlink, ///
device_block, ///
device_char, ///
namedpipe, ///
socket, ///
door, ///
unknown /** is possible only on Sun Solaris now */
}
///
alias curlfiletype = int;
///
enum CurlFInfoFlagKnown {
filename = 1, ///
filetype = 2, ///
time = 4, ///
perm = 8, ///
uid = 16, ///
gid = 32, ///
size = 64, ///
hlinkcount = 128 ///
}
/** Content of this structure depends on information which is known and is
achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
page for callbacks returning this structure -- some fields are mandatory,
some others are optional. The FLAG field has special meaning. */
/** If some of these fields is not NULL, it is a pointer to b_data. */
extern (C) struct _N2
{
char *time; ///
char *perm; ///
char *user; ///
char *group; ///
char *target; /** pointer to the target filename of a symlink */
}
/** Content of this structure depends on information which is known and is
achievable (e.g. by FTP LIST parsing). Please see the url_easy_setopt(3) man
page for callbacks returning this structure -- some fields are mandatory,
some others are optional. The FLAG field has special meaning. */
extern (C) struct curl_fileinfo
{
char *filename; ///
curlfiletype filetype; ///
time_t time; ///
uint perm; ///
int uid; ///
int gid; ///
curl_off_t size; ///
c_long hardlinks; ///
_N2 strings; ///
uint flags; ///
char *b_data; ///
size_t b_size; ///
size_t b_used; ///
}
/** return codes for CURLOPT_CHUNK_BGN_FUNCTION */
enum CurlChunkBgnFunc {
ok = 0, ///
fail = 1, /** tell the lib to end the task */
skip = 2 /** skip this chunk over */
}
/** if splitting of data transfer is enabled, this callback is called before
download of an individual chunk started. Note that parameter "remains" works
only for FTP wildcard downloading (for now), otherwise is not used */
alias curl_chunk_bgn_callback = c_long function(const(void) *transfer_info, void *ptr, int remains);
/** return codes for CURLOPT_CHUNK_END_FUNCTION */
enum CurlChunkEndFunc {
ok = 0, ///
fail = 1, ///
}
/** If splitting of data transfer is enabled this callback is called after
download of an individual chunk finished.
Note! After this callback was set then it have to be called FOR ALL chunks.
Even if downloading of this chunk was skipped in CHUNK_BGN_FUNC.
This is the reason why we don't need "transfer_info" parameter in this
callback and we are not interested in "remains" parameter too. */
alias curl_chunk_end_callback = c_long function(void *ptr);
/** return codes for FNMATCHFUNCTION */
enum CurlFnMAtchFunc {
match = 0, ///
nomatch = 1, ///
fail = 2 ///
}
/** callback type for wildcard downloading pattern matching. If the
string matches the pattern, return CURL_FNMATCHFUNC_MATCH value, etc. */
alias curl_fnmatch_callback = int function(void *ptr, in const(char) *pattern, in const(char) *string);
/// seek whence...
enum CurlSeekPos {
set, ///
current, ///
end ///
}
/** These are the return codes for the seek callbacks */
enum CurlSeek {
ok, ///
fail, /** fail the entire transfer */
cantseek /** tell libcurl seeking can't be done, so
libcurl might try other means instead */
}
///
alias curl_seek_callback = int function(void *instream, curl_off_t offset, int origin);
///
enum CurlReadFunc {
/** This is a return code for the read callback that, when returned, will
signal libcurl to immediately abort the current transfer. */
abort = 0x10000000,
/** This is a return code for the read callback that, when returned,
will const signal libcurl to pause sending data on the current
transfer. */
pause = 0x10000001
}
///
alias curl_read_callback = size_t function(char *buffer, size_t size, size_t nitems, void *instream);
///
enum CurlSockType {
ipcxn, /** socket created for a specific IP connection */
last /** never use */
}
///
alias curlsocktype = int;
///
alias curl_sockopt_callback = int function(void *clientp, curl_socket_t curlfd, curlsocktype purpose);
/** addrlen was a socklen_t type before 7.18.0 but it turned really
ugly and painful on the systems that lack this type */
extern (C) struct curl_sockaddr
{
int family; ///
int socktype; ///
int protocol; ///
uint addrlen; /** addrlen was a socklen_t type before 7.18.0 but it
turned really ugly and painful on the systems that
lack this type */
sockaddr addr; ///
}
///
alias curl_opensocket_callback = curl_socket_t function(void *clientp, curlsocktype purpose, curl_sockaddr *address);
///
enum CurlIoError
{
ok, /** I/O operation successful */
unknowncmd, /** command was unknown to callback */
failrestart, /** failed to restart the read */
last /** never use */
}
///
alias curlioerr = int;
///
enum CurlIoCmd {
nop, /** command was unknown to callback */
restartread, /** failed to restart the read */
last, /** never use */
}
///
alias curliocmd = int;
///
alias curl_ioctl_callback = curlioerr function(CURL *handle, int cmd, void *clientp);
/**
* The following typedef's are signatures of malloc, free, realloc, strdup and
* calloc respectively. Function pointers of these types can be passed to the
* curl_global_init_mem() function to set user defined memory management
* callback routines.
*/
alias curl_malloc_callback = void* function(size_t size);
/// ditto
alias curl_free_callback = void function(void *ptr);
/// ditto
alias curl_realloc_callback = void* function(void *ptr, size_t size);
/// ditto
alias curl_strdup_callback = char * function(in const(char) *str);
/// ditto
alias curl_calloc_callback = void* function(size_t nmemb, size_t size);
/** the kind of data that is passed to information_callback*/
enum CurlCallbackInfo {
text, ///
header_in, ///
header_out, ///
data_in, ///
data_out, ///
ssl_data_in, ///
ssl_data_out, ///
end ///
}
///
alias curl_infotype = int;
///
alias curl_debug_callback =
int function(CURL *handle, /** the handle/transfer this concerns */
curl_infotype type, /** what kind of data */
char *data, /** points to the data */
size_t size, /** size of the data pointed to */
void *userptr /** whatever the user please */
);
/** All possible error codes from all sorts of curl functions. Future versions
may return other values, stay prepared.
Always add new return codes last. Never *EVER* remove any. The return
codes must remain the same!
*/
enum CurlError
{
ok, ///
unsupported_protocol, /** 1 */
failed_init, /** 2 */
url_malformat, /** 3 */
not_built_in, /** 4 - [was obsoleted in August 2007 for
7.17.0, reused in April 2011 for 7.21.5] */
couldnt_resolve_proxy, /** 5 */
couldnt_resolve_host, /** 6 */
couldnt_connect, /** 7 */
ftp_weird_server_reply, /** 8 */
remote_access_denied, /** 9 a service was denied by the server
due to lack of access - when login fails
this is not returned. */
obsolete10, /** 10 - NOT USED */
ftp_weird_pass_reply, /** 11 */
obsolete12, /** 12 - NOT USED */
ftp_weird_pasv_reply, /** 13 */
ftp_weird_227_format, /** 14 */
ftp_cant_get_host, /** 15 */
obsolete16, /** 16 - NOT USED */
ftp_couldnt_set_type, /** 17 */
partial_file, /** 18 */
ftp_couldnt_retr_file, /** 19 */
obsolete20, /** 20 - NOT USED */
quote_error, /** 21 - quote command failure */
http_returned_error, /** 22 */
write_error, /** 23 */
obsolete24, /** 24 - NOT USED */
upload_failed, /** 25 - failed upload "command" */
read_error, /** 26 - couldn't open/read from file */
out_of_memory, /** 27 */
/** Note: CURLE_OUT_OF_MEMORY may sometimes indicate a conversion error
instead of a memory allocation error if CURL_DOES_CONVERSIONS
is defined
*/
operation_timedout, /** 28 - the timeout time was reached */
obsolete29, /** 29 - NOT USED */
ftp_port_failed, /** 30 - FTP PORT operation failed */
ftp_couldnt_use_rest, /** 31 - the REST command failed */
obsolete32, /** 32 - NOT USED */
range_error, /** 33 - RANGE "command" didn't work */
http_post_error, /** 34 */
ssl_connect_error, /** 35 - wrong when connecting with SSL */
bad_download_resume, /** 36 - couldn't resume download */
file_couldnt_read_file, /** 37 */
ldap_cannot_bind, /** 38 */
ldap_search_failed, /** 39 */
obsolete40, /** 40 - NOT USED */
function_not_found, /** 41 */
aborted_by_callback, /** 42 */
bad_function_argument, /** 43 */
obsolete44, /** 44 - NOT USED */
interface_failed, /** 45 - CURLOPT_INTERFACE failed */
obsolete46, /** 46 - NOT USED */
too_many_redirects, /** 47 - catch endless re-direct loops */
unknown_option, /** 48 - User specified an unknown option */
telnet_option_syntax, /** 49 - Malformed telnet option */
obsolete50, /** 50 - NOT USED */
peer_failed_verification, /** 51 - peer's certificate or fingerprint
wasn't verified fine */
got_nothing, /** 52 - when this is a specific error */
ssl_engine_notfound, /** 53 - SSL crypto engine not found */
ssl_engine_setfailed, /** 54 - can not set SSL crypto engine as default */
send_error, /** 55 - failed sending network data */
recv_error, /** 56 - failure in receiving network data */
obsolete57, /** 57 - NOT IN USE */
ssl_certproblem, /** 58 - problem with the local certificate */
ssl_cipher, /** 59 - couldn't use specified cipher */
ssl_cacert, /** 60 - problem with the CA cert (path?) */
bad_content_encoding, /** 61 - Unrecognized transfer encoding */
ldap_invalid_url, /** 62 - Invalid LDAP URL */
filesize_exceeded, /** 63 - Maximum file size exceeded */
use_ssl_failed, /** 64 - Requested FTP SSL level failed */
send_fail_rewind, /** 65 - Sending the data requires a rewind that failed */
ssl_engine_initfailed, /** 66 - failed to initialise ENGINE */
login_denied, /** 67 - user, password or similar was not accepted and we failed to login */
tftp_notfound, /** 68 - file not found on server */
tftp_perm, /** 69 - permission problem on server */
remote_disk_full, /** 70 - out of disk space on server */
tftp_illegal, /** 71 - Illegal TFTP operation */
tftp_unknownid, /** 72 - Unknown transfer ID */
remote_file_exists, /** 73 - File already exists */
tftp_nosuchuser, /** 74 - No such user */
conv_failed, /** 75 - conversion failed */
conv_reqd, /** 76 - caller must register conversion
callbacks using curl_easy_setopt options
CURLOPT_CONV_FROM_NETWORK_FUNCTION,
CURLOPT_CONV_TO_NETWORK_FUNCTION, and
CURLOPT_CONV_FROM_UTF8_FUNCTION */
ssl_cacert_badfile, /** 77 - could not load CACERT file, missing or wrong format */
remote_file_not_found, /** 78 - remote file not found */
ssh, /** 79 - error from the SSH layer, somewhat
generic so the error message will be of
interest when this has happened */
ssl_shutdown_failed, /** 80 - Failed to shut down the SSL connection */
again, /** 81 - socket is not ready for send/recv,
wait till it's ready and try again (Added
in 7.18.2) */
ssl_crl_badfile, /** 82 - could not load CRL file, missing or wrong format (Added in 7.19.0) */
ssl_issuer_error, /** 83 - Issuer check failed. (Added in 7.19.0) */
ftp_pret_failed, /** 84 - a PRET command failed */
rtsp_cseq_error, /** 85 - mismatch of RTSP CSeq numbers */
rtsp_session_error, /** 86 - mismatch of RTSP Session Identifiers */
ftp_bad_file_list, /** 87 - unable to parse FTP file list */
chunk_failed, /** 88 - chunk callback reported error */
curl_last /** never use! */
}
///
alias CURLcode = int;
/** This prototype applies to all conversion callbacks */
alias curl_conv_callback = CURLcode function(char *buffer, size_t length);
/** actually an OpenSSL SSL_CTX */
alias curl_ssl_ctx_callback =
CURLcode function(CURL *curl, /** easy handle */
void *ssl_ctx, /** actually an OpenSSL SSL_CTX */
void *userptr
);
///
enum CurlProxy {
http, /** added in 7.10, new in 7.19.4 default is to use CONNECT HTTP/1.1 */
http_1_0, /** added in 7.19.4, force to use CONNECT HTTP/1.0 */
socks4 = 4, /** support added in 7.15.2, enum existed already in 7.10 */
socks5 = 5, /** added in 7.10 */
socks4a = 6, /** added in 7.18.0 */
socks5_hostname =7 /** Use the SOCKS5 protocol but pass along the
host name rather than the IP address. added
in 7.18.0 */
}
///
alias curl_proxytype = int;
///
enum CurlAuth : long {
none = 0,
basic = 1, /** Basic (default) */
digest = 2, /** Digest */
gssnegotiate = 4, /** GSS-Negotiate */
ntlm = 8, /** NTLM */
digest_ie = 16, /** Digest with IE flavour */
only = 2_147_483_648, /** used together with a single other
type to force no auth or just that
single type */
any = -17, /* (~CURLAUTH_DIGEST_IE) */ /** all fine types set */
anysafe = -18 /* (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) */ ///
}
///
enum CurlSshAuth {
any = -1, /** all types supported by the server */
none = 0, /** none allowed, silly but complete */
publickey = 1, /** public/private key files */
password = 2, /** password */
host = 4, /** host key files */
keyboard = 8, /** keyboard interactive */
default_ = -1 // CURLSSH_AUTH_ANY;
}
///
enum CURL_ERROR_SIZE = 256;
/** points to a zero-terminated string encoded with base64
if len is zero, otherwise to the "raw" data */
enum CurlKHType
{
unknown, ///
rsa1, ///
rsa, ///
dss ///
}
///
extern (C) struct curl_khkey
{
const(char) *key; /** points to a zero-terminated string encoded with base64
if len is zero, otherwise to the "raw" data */
size_t len; ///
CurlKHType keytype; ///
}
/** this is the set of return values expected from the curl_sshkeycallback
callback */
enum CurlKHStat {
fine_add_to_file, ///
fine, ///
reject, /** reject the connection, return an error */
defer, /** do not accept it, but we can't answer right now so
this causes a CURLE_DEFER error but otherwise the
connection will be left intact etc */
last /** not for use, only a marker for last-in-list */
}
/** this is the set of status codes pass in to the callback */
enum CurlKHMatch {
ok, /** match */
mismatch, /** host found, key mismatch! */
missing, /** no matching host/key found */
last /** not for use, only a marker for last-in-list */
}
///
alias curl_sshkeycallback =
int function(CURL *easy, /** easy handle */
const(curl_khkey) *knownkey, /** known */
const(curl_khkey) *foundkey, /** found */
CurlKHMatch m, /** libcurl's view on the keys */
void *clientp /** custom pointer passed from app */
);
/** parameter for the CURLOPT_USE_SSL option */
enum CurlUseSSL {
none, /** do not attempt to use SSL */
tryssl, /** try using SSL, proceed anyway otherwise */
control, /** SSL for the control connection or fail */
all, /** SSL for all communication or fail */
last /** not an option, never use */
}
///
alias curl_usessl = int;
/** parameter for the CURLOPT_FTP_SSL_CCC option */
enum CurlFtpSSL {
ccc_none, /** do not send CCC */
ccc_passive, /** Let the server initiate the shutdown */
ccc_active, /** Initiate the shutdown */
ccc_last /** not an option, never use */
}
///
alias curl_ftpccc = int;
/** parameter for the CURLOPT_FTPSSLAUTH option */
enum CurlFtpAuth {
defaultauth, /** let libcurl decide */
ssl, /** use "AUTH SSL" */
tls, /** use "AUTH TLS" */
last /** not an option, never use */
}
///
alias curl_ftpauth = int;
/** parameter for the CURLOPT_FTP_CREATE_MISSING_DIRS option */
enum CurlFtp {
create_dir_none, /** do NOT create missing dirs! */
create_dir, /** (FTP/SFTP) if CWD fails, try MKD and then CWD again if MKD
succeeded, for SFTP this does similar magic */
create_dir_retry, /** (FTP only) if CWD fails, try MKD and then CWD again even if MKD
failed! */
create_dir_last /** not an option, never use */
}
///
alias curl_ftpcreatedir = int;
/** parameter for the CURLOPT_FTP_FILEMETHOD option */
enum CurlFtpMethod {
defaultmethod, /** let libcurl pick */
multicwd, /** single CWD operation for each path part */
nocwd, /** no CWD at all */
singlecwd, /** one CWD to full dir, then work on file */
last /** not an option, never use */
}
///
alias curl_ftpmethod = int;
/** CURLPROTO_ defines are for the CURLOPT_*PROTOCOLS options */
enum CurlProto {
http = 1, ///
https = 2, ///
ftp = 4, ///
ftps = 8, ///
scp = 16, ///
sftp = 32, ///
telnet = 64, ///
ldap = 128, ///
ldaps = 256, ///
dict = 512, ///
file = 1024, ///
tftp = 2048, ///
imap = 4096, ///
imaps = 8192, ///
pop3 = 16_384, ///
pop3s = 32_768, ///
smtp = 65_536, ///
smtps = 131_072, ///
rtsp = 262_144, ///
rtmp = 524_288, ///
rtmpt = 1_048_576, ///
rtmpe = 2_097_152, ///
rtmpte = 4_194_304, ///
rtmps = 8_388_608, ///
rtmpts = 16_777_216, ///
gopher = 33_554_432, ///
all = -1 /** enable everything */
}
/** long may be 32 or 64 bits, but we should never depend on anything else
but 32 */
enum CURLOPTTYPE_LONG = 0;
/// ditto
enum CURLOPTTYPE_OBJECTPOINT = 10_000;
/// ditto
enum CURLOPTTYPE_FUNCTIONPOINT = 20_000;
/// ditto
enum CURLOPTTYPE_OFF_T = 30_000;
/** name is uppercase CURLOPT_$(LT)name$(GT),
type is one of the defined CURLOPTTYPE_$(LT)type$(GT)
number is unique identifier */
/** The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
alias LONG = CURLOPTTYPE_LONG;
/// ditto
alias OBJECTPOINT = CURLOPTTYPE_OBJECTPOINT;
/// ditto
alias FUNCTIONPOINT = CURLOPTTYPE_FUNCTIONPOINT;
/// ditto
alias OFF_T = CURLOPTTYPE_OFF_T;
///
enum CurlOption {
/** This is the FILE * or void * the regular output should be written to. */
file = 10_001,
/** The full URL to get/put */
url,
/** Port number to connect to, if other than default. */
port = 3,
/** Name of proxy to use. */
proxy = 10_004,
/** "name:password" to use when fetching. */
userpwd,
/** "name:password" to use with proxy. */
proxyuserpwd,
/** Range to get, specified as an ASCII string. */
range,
/** not used */
/** Specified file stream to upload from (use as input): */
infile = 10_009,
/** Buffer to receive error messages in, must be at least CURL_ERROR_SIZE
* bytes big. If this is not used, error messages go to stderr instead: */
errorbuffer,
/** Function that will be called to store the output (instead of fwrite). The
* parameters will use fwrite() syntax, make sure to follow them. */
writefunction = 20_011,
/** Function that will be called to read the input (instead of fread). The
* parameters will use fread() syntax, make sure to follow them. */
readfunction,
/** Time-out the read operation after this amount of seconds */
timeout = 13,
/** If the CURLOPT_INFILE is used, this can be used to inform libcurl about
* how large the file being sent really is. That allows better error
* checking and better verifies that the upload was successful. -1 means
* unknown size.
*
* For large file support, there is also a _LARGE version of the key
* which takes an off_t type, allowing platforms with larger off_t
* sizes to handle larger files. See below for INFILESIZE_LARGE.
*/
infilesize,
/** POST static input fields. */
postfields = 10_015,
/** Set the referrer page (needed by some CGIs) */
referer,
/** Set the FTP PORT string (interface name, named or numerical IP address)
Use i.e '-' to use default address. */
ftpport,
/** Set the User-Agent string (examined by some CGIs) */
useragent,
/** If the download receives less than "low speed limit" bytes/second
* during "low speed time" seconds, the operations is aborted.
* You could i.e if you have a pretty high speed connection, abort if
* it is less than 2000 bytes/sec during 20 seconds.
*/
/** Set the "low speed limit" */
low_speed_limit = 19,
/** Set the "low speed time" */
low_speed_time,
/** Set the continuation offset.
*
* Note there is also a _LARGE version of this key which uses
* off_t types, allowing for large file offsets on platforms which
* use larger-than-32-bit off_t's. Look below for RESUME_FROM_LARGE.
*/
resume_from,
/** Set cookie in request: */
cookie = 10_022,
/** This points to a linked list of headers, struct curl_slist kind */
httpheader,
/** This points to a linked list of post entries, struct curl_httppost */
httppost,
/** name of the file keeping your private SSL-certificate */
sslcert,
/** password for the SSL or SSH private key */
keypasswd,
/** send TYPE parameter? */
crlf = 27,
/** send linked-list of QUOTE commands */
quote = 10_028,
/** send FILE * or void * to store headers to, if you use a callback it
is simply passed to the callback unmodified */
writeheader,
/** point to a file to read the initial cookies from, also enables
"cookie awareness" */
cookiefile = 10_031,
/** What version to specifically try to use.
See CURL_SSLVERSION defines below. */
sslversion = 32,
/** What kind of HTTP time condition to use, see defines */
timecondition,
/** Time to use with the above condition. Specified in number of seconds
since 1 Jan 1970 */
timevalue,
/* 35 = OBSOLETE */
/** Custom request, for customizing the get command like
HTTP: DELETE, TRACE and others
FTP: to use a different list command
*/
customrequest = 10_036,
/** HTTP request, for odd commands like DELETE, TRACE and others */
stderr,
/* 38 is not used */
/** send linked-list of post-transfer QUOTE commands */
postquote = 10_039,
/** Pass a pointer to string of the output using full variable-replacement
as described elsewhere. */
writeinfo,
verbose = 41, /** talk a lot */
header, /** throw the header out too */
noprogress, /** shut off the progress meter */
nobody, /** use HEAD to get http document */
failonerror, /** no output on http error codes >= 300 */
upload, /** this is an upload */
post, /** HTTP POST method */
dirlistonly, /** return bare names when listing directories */
append = 50, /** Append instead of overwrite on upload! */
/** Specify whether to read the user+password from the .netrc or the URL.
* This must be one of the CURL_NETRC_* enums below. */
netrc,
followlocation, /** use Location: Luke! */
transfertext, /** transfer data in text/ASCII format */
put, /** HTTP PUT */
/* 55 = OBSOLETE */
/** Function that will be called instead of the internal progress display
* function. This function should be defined as the curl_progress_callback
* prototype defines. */
progressfunction = 20_056,
/** Data passed to the progress callback */
progressdata = 10_057,
/** We want the referrer field set automatically when following locations */
autoreferer = 58,
/** Port of the proxy, can be set in the proxy string as well with:
"[host]:[port]" */
proxyport,
/** size of the POST input data, if strlen() is not good to use */
postfieldsize,
/** tunnel non-http operations through a HTTP proxy */
httpproxytunnel,
/** Set the interface string to use as outgoing network interface */
intrface = 10_062,
/** Set the krb4/5 security level, this also enables krb4/5 awareness. This
* is a string, 'clear', 'safe', 'confidential' or 'private'. If the string
* is set but doesn't match one of these, 'private' will be used. */
krblevel,
/** Set if we should verify the peer in ssl handshake, set 1 to verify. */
ssl_verifypeer = 64,
/** The CApath or CAfile used to validate the peer certificate
this option is used only if SSL_VERIFYPEER is true */
cainfo = 10_065,
/* 66 = OBSOLETE */
/* 67 = OBSOLETE */
/** Maximum number of http redirects to follow */
maxredirs = 68,
/** Pass a long set to 1 to get the date of the requested document (if
possible)! Pass a zero to shut it off. */
filetime,
/** This points to a linked list of telnet options */
telnetoptions = 10_070,
/** Max amount of cached alive connections */
maxconnects = 71,
/** What policy to use when closing connections when the cache is filled
up */
closepolicy,
/* 73 = OBSOLETE */
/** Set to explicitly use a new connection for the upcoming transfer.
Do not use this unless you're absolutely sure of this, as it makes the
operation slower and is less friendly for the network. */
fresh_connect = 74,
/** Set to explicitly forbid the upcoming transfer's connection to be re-used
when done. Do not use this unless you're absolutely sure of this, as it
makes the operation slower and is less friendly for the network. */
forbid_reuse,
/** Set to a file name that contains random data for libcurl to use to
seed the random engine when doing SSL connects. */
random_file = 10_076,
/** Set to the Entropy Gathering Daemon socket pathname */
egdsocket,
/** Time-out connect operations after this amount of seconds, if connects
are OK within this time, then fine... This only aborts the connect
phase. [Only works on unix-style/SIGALRM operating systems] */
connecttimeout = 78,
/** Function that will be called to store headers (instead of fwrite). The
* parameters will use fwrite() syntax, make sure to follow them. */
headerfunction = 20_079,
/** Set this to force the HTTP request to get back to GET. Only really usable
if POST, PUT or a custom request have been used first.
*/
httpget = 80,
/** Set if we should verify the Common name from the peer certificate in ssl
* handshake, set 1 to check existence, 2 to ensure that it matches the
* provided hostname. */
ssl_verifyhost,
/** Specify which file name to write all known cookies in after completed
operation. Set file name to "-" (dash) to make it go to stdout. */
cookiejar = 10_082,
/** Specify which SSL ciphers to use */
ssl_cipher_list,
/** Specify which HTTP version to use! This must be set to one of the
CURL_HTTP_VERSION* enums set below. */
http_version = 84,
/** Specifically switch on or off the FTP engine's use of the EPSV command. By
default, that one will always be attempted before the more traditional
PASV command. */
ftp_use_epsv,
/** type of the file keeping your SSL-certificate ("DER", "PEM", "ENG") */
sslcerttype = 10_086,
/** name of the file keeping your private SSL-key */
sslkey,
/** type of the file keeping your private SSL-key ("DER", "PEM", "ENG") */
sslkeytype,
/** crypto engine for the SSL-sub system */
sslengine,
/** set the crypto engine for the SSL-sub system as default
the param has no meaning...
*/
sslengine_default = 90,
/** Non-zero value means to use the global dns cache */
dns_use_global_cache,
/** DNS cache timeout */
dns_cache_timeout,
/** send linked-list of pre-transfer QUOTE commands */
prequote = 10_093,
/** set the debug function */
debugfunction = 20_094,
/** set the data for the debug function */
debugdata = 10_095,
/** mark this as start of a cookie session */
cookiesession = 96,
/** The CApath directory used to validate the peer certificate
this option is used only if SSL_VERIFYPEER is true */
capath = 10_097,
/** Instruct libcurl to use a smaller receive buffer */
buffersize = 98,
/** Instruct libcurl to not use any signal/alarm handlers, even when using
timeouts. This option is useful for multi-threaded applications.
See libcurl-the-guide for more background information. */
nosignal,
/** Provide a CURLShare for mutexing non-ts data */
share = 10_100,
/** indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */
proxytype = 101,
/** Set the Accept-Encoding string. Use this to tell a server you would like
the response to be compressed. */
encoding = 10_102,
/** Set pointer to private data */
private_opt,
/** Set aliases for HTTP 200 in the HTTP Response header */
http200aliases,
/** Continue to send authentication (user+password) when following locations,
even when hostname changed. This can potentially send off the name
and password to whatever host the server decides. */
unrestricted_auth = 105,
/** Specifically switch on or off the FTP engine's use of the EPRT command ( it
also disables the LPRT attempt). By default, those ones will always be
attempted before the good old traditional PORT command. */
ftp_use_eprt,
/** Set this to a bitmask value to enable the particular authentications
methods you like. Use this in combination with CURLOPT_USERPWD.
Note that setting multiple bits may cause extra network round-trips. */
httpauth,