-
Notifications
You must be signed in to change notification settings - Fork 34
/
curl.ml
1572 lines (1298 loc) · 47.9 KB
/
curl.ml
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
(*
* curl.ml
*
* Copyright (c) 2003-2008, Lars Nilsson, <lars@quantumchamaeleon.com>
* Copyright (c) 2009, ygrek, <ygrek@autistici.org>
*)
type t
type curlCode =
| CURLE_OK
| CURLE_UNSUPPORTED_PROTOCOL
| CURLE_FAILED_INIT
| CURLE_URL_MALFORMAT
| CURLE_URL_MALFORMAT_USER
| CURLE_COULDNT_RESOLVE_PROXY
| CURLE_COULDNT_RESOLVE_HOST
| CURLE_COULDNT_CONNECT
| CURLE_FTP_WEIRD_SERVER_REPLY
| CURLE_FTP_ACCESS_DENIED
| CURLE_FTP_USER_PASSWORD_INCORRECT
| CURLE_FTP_WEIRD_PASS_REPLY
| CURLE_FTP_WEIRD_USER_REPLY
| CURLE_FTP_WEIRD_PASV_REPLY
| CURLE_FTP_WEIRD_227_FORMAT
| CURLE_FTP_CANT_GET_HOST
| CURLE_FTP_CANT_RECONNECT
| CURLE_FTP_COULDNT_SET_BINARY
| CURLE_PARTIAL_FILE
| CURLE_FTP_COULDNT_RETR_FILE
| CURLE_FTP_WRITE_ERROR
| CURLE_FTP_QUOTE_ERROR
| CURLE_HTTP_NOT_FOUND
| CURLE_WRITE_ERROR
| CURLE_MALFORMAT_USER
| CURLE_FTP_COULDNT_STOR_FILE
| CURLE_READ_ERROR
| CURLE_OUT_OF_MEMORY
| CURLE_OPERATION_TIMEOUTED
| CURLE_FTP_COULDNT_SET_ASCII
| CURLE_FTP_PORT_FAILED
| CURLE_FTP_COULDNT_USE_REST
| CURLE_FTP_COULDNT_GET_SIZE
| CURLE_HTTP_RANGE_ERROR
| CURLE_HTTP_POST_ERROR
| CURLE_SSL_CONNECT_ERROR
| CURLE_FTP_BAD_DOWNLOAD_RESUME
| CURLE_FILE_COULDNT_READ_FILE
| CURLE_LDAP_CANNOT_BIND
| CURLE_LDAP_SEARCH_FAILED
| CURLE_LIBRARY_NOT_FOUND
| CURLE_FUNCTION_NOT_FOUND
| CURLE_ABORTED_BY_CALLBACK
| CURLE_BAD_FUNCTION_ARGUMENT
| CURLE_BAD_CALLING_ORDER
| CURLE_HTTP_PORT_FAILED
| CURLE_BAD_PASSWORD_ENTERED
| CURLE_TOO_MANY_REDIRECTS
| CURLE_UNKNOWN_TELNET_OPTION
| CURLE_TELNET_OPTION_SYNTAX
| CURLE_OBSOLETE
| CURLE_SSL_PEER_CERTIFICATE
| CURLE_GOT_NOTHING
| CURLE_SSL_ENGINE_NOTFOUND
| CURLE_SSL_ENGINE_SETFAILED
| CURLE_SEND_ERROR
| CURLE_RECV_ERROR
| CURLE_SHARE_IN_USE
| CURLE_SSL_CERTPROBLEM
| CURLE_SSL_CIPHER
| CURLE_SSL_CACERT
| CURLE_BAD_CONTENT_ENCODING
| CURLE_LDAP_INVALID_URL
| CURLE_FILESIZE_EXCEEDED
| CURLE_USE_SSL_FAILED
| CURLE_SEND_FAIL_REWIND
| CURLE_SSL_ENGINE_INITFAILED
| CURLE_LOGIN_DENIED
| CURLE_TFTP_NOTFOUND
| CURLE_TFTP_PERM
| CURLE_REMOTE_DISK_FULL
| CURLE_TFTP_ILLEGAL
| CURLE_TFTP_UNKNOWNID
| CURLE_REMOTE_FILE_EXISTS
| CURLE_TFTP_NOSUCHUSER
| CURLE_CONV_FAILED
| CURLE_CONV_REQD
| CURLE_SSL_CACERT_BADFILE
| CURLE_REMOTE_FILE_NOT_FOUND
| CURLE_SSH
| CURLE_SSL_SHUTDOWN_FAILED
| CURLE_AGAIN
exception CurlException of (curlCode * int * string)
type curlNETRCOption =
| CURL_NETRC_OPTIONAL
| CURL_NETRC_IGNORED
| CURL_NETRC_REQUIRED
type curlEncoding =
| CURL_ENCODING_NONE
| CURL_ENCODING_DEFLATE
| CURL_ENCODING_GZIP
| CURL_ENCODING_ANY
type curlContentType =
| DEFAULT
| CONTENTTYPE of string
type curlHTTPPost =
| CURLFORM_CONTENT of string * string * curlContentType
| CURLFORM_FILECONTENT of string * string * curlContentType
| CURLFORM_FILE of string * string * curlContentType
| CURLFORM_BUFFER of string * string * string * curlContentType
(*
type curlHTTPPost =
| CURLFORM_COPYNAME of string
| CURLFORM_PTRNAME of string
| CURLFORM_NAMELENGTH of int
| CURLFORM_COPYCONTENTS of string
| CURLFORM_PTRCONTENTS of string
| CURLFORM_FILE of string
| CURLFORM_FILECONTENT of string
| CURLFORM_CONTENTSLENGTH of int
| CURLFORM_CONTENTTYPE of string
*)
type curlSSLVersion =
| SSLVERSION_DEFAULT
| SSLVERSION_TLSv1
| SSLVERSION_SSLv2
| SSLVERSION_SSLv3
| SSLVERSION_TLSv1_0
| SSLVERSION_TLSv1_1
| SSLVERSION_TLSv1_2
| SSLVERSION_TLSv1_3
type curlTimeCondition =
| TIMECOND_NONE
| TIMECOND_IFMODSINCE
| TIMECOND_IFUNMODSINCE
| TIMECOND_LASTMOD
type curlKRB4Level =
| KRB4_NONE
| KRB4_CLEAR
| KRB4_SAFE
| KRB4_CONFIDENTIAL
| KRB4_PRIVATE
type curlClosePolicy =
| CLOSEPOLICY_OLDEST
| CLOSEPOLICY_LEAST_RECENTLY_USED
type curlSSLVerifyHost =
| SSLVERIFYHOST_NONE
| SSLVERIFYHOST_EXISTENCE
| SSLVERIFYHOST_HOSTNAME
type curlHTTPVersion =
| HTTP_VERSION_NONE
| HTTP_VERSION_1_0
| HTTP_VERSION_1_1
| HTTP_VERSION_2
| HTTP_VERSION_2TLS
| HTTP_VERSION_2_PRIOR_KNOWLEDGE
| HTTP_VERSION_3
type curlDebugType =
| DEBUGTYPE_TEXT
| DEBUGTYPE_HEADER_IN
| DEBUGTYPE_HEADER_OUT
| DEBUGTYPE_DATA_IN
| DEBUGTYPE_DATA_OUT
| DEBUGTYPE_SSL_DATA_IN
| DEBUGTYPE_SSL_DATA_OUT
| DEBUGTYPE_END
type curlAuth =
| CURLAUTH_BASIC
| CURLAUTH_DIGEST
| CURLAUTH_GSSNEGOTIATE
| CURLAUTH_NTLM
| CURLAUTH_ANY
| CURLAUTH_ANYSAFE
type curlIPResolve =
| IPRESOLVE_WHATEVER
| IPRESOLVE_V4
| IPRESOLVE_V6
type curlFTPSSL =
| FTPSSL_NONE
| FTPSSL_TRY
| FTPSSL_CONTROL
| FTPSSL_ALL
type curlFTPSSLAuth =
| FTPAUTH_DEFAULT
| FTPAUTH_SSL
| FTPAUTH_TLS
type curlIOCmd =
| IOCMD_NOP
| IOCMD_RESTARTREAD
type curlIOErr =
| IOE_OK
| IOE_UNKNOWNCMD
| IOE_FAILRESTART
type curlSeekResult =
| SEEKFUNC_OK
| SEEKFUNC_FAIL
| SEEKFUNC_CANTSEEK
type curlFTPMethod =
| FTPMETHOD_DEFAULT
| FTPMETHOD_MULTICWD
| FTPMETHOD_NOCWD
| FTPMETHOD_SINGLECWD
type curlSSHAuthTypes =
| SSHAUTH_ANY
| SSHAUTH_PUBLICKEY
| SSHAUTH_PASSWORD
| SSHAUTH_HOST
| SSHAUTH_KEYBOARD
type curlFTPSSLCCC =
| FTPSSL_CCC_NONE
| FTPSSL_CCC_PASSIVE
| FTPSSL_CCC_ACTIVE
type curlSeek =
| SEEK_SET
| SEEK_CUR
| SEEK_END
type curlProxyType =
| CURLPROXY_HTTP
| CURLPROXY_HTTP_1_0 (** added in 7.19.4 *)
| CURLPROXY_SOCKS4 (** added in 7.15.2 *)
| CURLPROXY_SOCKS5
| CURLPROXY_SOCKS4A (** added in 7.18.0 *)
| CURLPROXY_SOCKS5_HOSTNAME (** added in 7.18.0 *)
type data_source =
| String of string (** Equivalent to `CURLMIME_DATA` *)
| File of string (** Equivalent to `CURLMIME_FILEDATA` *)
type curlMIMEPartData =
| CURLMIME_DATA of string
| CURLMIME_FILEDATA of string
| CURLMIME_DATA_WITH_NAME of {
data: data_source;
name: string option;
filename: string option;
}
type curlMIMEEncoding =
| CURLMIME_8BIT
| CURLMIME_BINARY
| CURLMIME_7BIT
| CURLMIME_QUOTEDPRINTABLE
| CURLMIME_BASE64
| CURLMIME_NONE
type curlMIMEPart =
{
encoding: curlMIMEEncoding;
headers: string list;
subparts: curlMIMEPart list;
data: curlMIMEPartData;
}
type curlKHMatch =
| CURLKHMATCH_OK
| CURLKHMATCH_MISMATCH of string
| CURLKHMATCH_MISSING
type curlKHStat =
| CURLKHSTAT_FINE_ADD_TO_FILE
| CURLKHSTAT_FINE
| CURLKHSTAT_REJECT
| CURLKHSTAT_DEFER
(** Protocols to enable (via CURLOPT_PROTOCOLS and CURLOPT_REDIR_PROTOCOLS) *)
type curlProto =
| CURLPROTO_ALL (** enable everything *)
| CURLPROTO_HTTP
| CURLPROTO_HTTPS
| CURLPROTO_FTP
| CURLPROTO_FTPS
| CURLPROTO_SCP
| CURLPROTO_SFTP
| CURLPROTO_TELNET
| CURLPROTO_LDAP
| CURLPROTO_LDAPS
| CURLPROTO_DICT
| CURLPROTO_FILE
| CURLPROTO_TFTP
| CURLPROTO_IMAP
| CURLPROTO_IMAPS
| CURLPROTO_POP3
| CURLPROTO_POP3S
| CURLPROTO_SMTP
| CURLPROTO_SMTPS
| CURLPROTO_RTSP
| CURLPROTO_RTMP
| CURLPROTO_RTMPT
| CURLPROTO_RTMPE
| CURLPROTO_RTMPTE
| CURLPROTO_RTMPS
| CURLPROTO_RTMPTS
| CURLPROTO_GOPHER
(* sync curlPostRedir_table *)
type curlPostRedir =
| REDIR_POST_ALL
| REDIR_POST_301
| REDIR_POST_302
| REDIR_POST_303
type curlSslOption =
| CURLSSLOPT_ALLOW_BEAST
| CURLSSLOPT_NO_REVOKE
| CURLSSLOPT_NO_PARTIALCHAIN
| CURLSSLOPT_REVOKE_BEST_EFFORT
| CURLSSLOPT_NATIVE_CA
| CURLSSLOPT_AUTO_CLIENT_CERT
type 'a xfer_result = Proceed of 'a | Pause | Abort
type write_result = unit xfer_result
type read_result = string xfer_result
let proceed = Proceed ()
type curlOption =
| CURLOPT_WRITEFUNCTION of (string -> int)
| CURLOPT_READFUNCTION of (int -> string)
| CURLOPT_INFILESIZE of int
| CURLOPT_URL of string
| CURLOPT_PROXY of string
| CURLOPT_PROXYPORT of int
| CURLOPT_HTTPPROXYTUNNEL of bool
| CURLOPT_VERBOSE of bool
| CURLOPT_HEADER of bool
| CURLOPT_NOPROGRESS of bool
| CURLOPT_NOSIGNAL of bool
| CURLOPT_NOBODY of bool
| CURLOPT_FAILONERROR of bool
| CURLOPT_UPLOAD of bool
| CURLOPT_POST of bool
| CURLOPT_FTPLISTONLY of bool
| CURLOPT_FTPAPPEND of bool
| CURLOPT_NETRC of curlNETRCOption
| CURLOPT_ENCODING of curlEncoding
| CURLOPT_FOLLOWLOCATION of bool
| CURLOPT_TRANSFERTEXT of bool
| CURLOPT_PUT of bool
| CURLOPT_USERPWD of string
| CURLOPT_PROXYUSERPWD of string
| CURLOPT_RANGE of string
| CURLOPT_ERRORBUFFER of string ref
| CURLOPT_TIMEOUT of int
| CURLOPT_POSTFIELDS of string
| CURLOPT_POSTFIELDSIZE of int
| CURLOPT_REFERER of string
| CURLOPT_USERAGENT of string
| CURLOPT_FTPPORT of string
| CURLOPT_LOWSPEEDLIMIT of int
| CURLOPT_LOWSPEEDTIME of int
| CURLOPT_RESUMEFROM of int
| CURLOPT_COOKIE of string
| CURLOPT_HTTPHEADER of string list
| CURLOPT_HTTPPOST of curlHTTPPost list
| CURLOPT_SSLCERT of string
| CURLOPT_SSLCERTTYPE of string
| CURLOPT_SSLCERTPASSWD of string
| CURLOPT_SSLKEY of string
| CURLOPT_SSLKEYTYPE of string
| CURLOPT_SSLKEYPASSWD of string
| CURLOPT_SSLENGINE of string
| CURLOPT_SSLENGINEDEFAULT of bool
| CURLOPT_CRLF of bool
| CURLOPT_QUOTE of string list
| CURLOPT_POSTQUOTE of string list
| CURLOPT_HEADERFUNCTION of (string -> int)
| CURLOPT_COOKIEFILE of string
| CURLOPT_SSLVERSION of curlSSLVersion
| CURLOPT_TIMECONDITION of curlTimeCondition
| CURLOPT_TIMEVALUE of int32
| CURLOPT_CUSTOMREQUEST of string
| CURLOPT_INTERFACE of string
| CURLOPT_KRB4LEVEL of curlKRB4Level
| CURLOPT_PROGRESSFUNCTION of (float -> float -> float -> float -> bool)
| CURLOPT_SSLVERIFYPEER of bool
| CURLOPT_CAINFO of string
| CURLOPT_CAPATH of string
| CURLOPT_FILETIME of bool
| CURLOPT_MAXREDIRS of int
| CURLOPT_MAXCONNECTS of int
| CURLOPT_CLOSEPOLICY of curlClosePolicy
| CURLOPT_FRESHCONNECT of bool
| CURLOPT_FORBIDREUSE of bool
| CURLOPT_RANDOMFILE of string
| CURLOPT_EGDSOCKET of string
| CURLOPT_CONNECTTIMEOUT of int
| CURLOPT_HTTPGET of bool
| CURLOPT_SSLVERIFYHOST of curlSSLVerifyHost
| CURLOPT_COOKIEJAR of string
| CURLOPT_SSLCIPHERLIST of string
| CURLOPT_HTTPVERSION of curlHTTPVersion
| CURLOPT_FTPUSEEPSV of bool
| CURLOPT_DNSCACHETIMEOUT of int
| CURLOPT_DNSUSEGLOBALCACHE of bool
| CURLOPT_DEBUGFUNCTION of (t -> curlDebugType -> string -> unit)
| CURLOPT_PRIVATE of string
| CURLOPT_HTTP200ALIASES of string list
| CURLOPT_UNRESTRICTEDAUTH of bool
| CURLOPT_FTPUSEEPRT of bool
| CURLOPT_HTTPAUTH of curlAuth list
| CURLOPT_FTPCREATEMISSINGDIRS of bool
| CURLOPT_PROXYAUTH of curlAuth list
| CURLOPT_FTPRESPONSETIMEOUT of int
| CURLOPT_IPRESOLVE of curlIPResolve
| CURLOPT_MAXFILESIZE of int32
| CURLOPT_INFILESIZELARGE of int64
| CURLOPT_RESUMEFROMLARGE of int64
| CURLOPT_MAXFILESIZELARGE of int64
| CURLOPT_NETRCFILE of string
| CURLOPT_FTPSSL of curlFTPSSL
| CURLOPT_POSTFIELDSIZELARGE of int64
| CURLOPT_TCPNODELAY of bool
| CURLOPT_TCP_FASTOPEN of bool
| CURLOPT_FTPSSLAUTH of curlFTPSSLAuth
| CURLOPT_IOCTLFUNCTION of (t -> curlIOCmd -> curlIOErr)
| CURLOPT_FTPACCOUNT of string
| CURLOPT_COOKIELIST of string
| CURLOPT_IGNORECONTENTLENGTH of bool
| CURLOPT_FTPSKIPPASVIP of bool
| CURLOPT_FTPFILEMETHOD of curlFTPMethod
| CURLOPT_LOCALPORT of int
| CURLOPT_LOCALPORTRANGE of int
| CURLOPT_CONNECTONLY of bool
| CURLOPT_MAXSENDSPEEDLARGE of int64
| CURLOPT_MAXRECVSPEEDLARGE of int64
| CURLOPT_FTPALTERNATIVETOUSER of string
| CURLOPT_SSLSESSIONIDCACHE of bool
| CURLOPT_SSHAUTHTYPES of curlSSHAuthTypes list
| CURLOPT_SSHPUBLICKEYFILE of string
| CURLOPT_SSHPRIVATEKEYFILE of string
| CURLOPT_FTPSSLCCC of curlFTPSSLCCC
| CURLOPT_TIMEOUTMS of int
| CURLOPT_CONNECTTIMEOUTMS of int
| CURLOPT_HTTPTRANSFERDECODING of bool
| CURLOPT_HTTPCONTENTDECODING of bool
| CURLOPT_NEWFILEPERMS of int
| CURLOPT_NEWDIRECTORYPERMS of int
| CURLOPT_POST301 of bool
| CURLOPT_SSHHOSTPUBLICKEYMD5 of string
| CURLOPT_COPYPOSTFIELDS of string
| CURLOPT_PROXYTRANSFERMODE of bool
| CURLOPT_SEEKFUNCTION of (int64 -> curlSeek -> curlSeekResult)
| CURLOPT_AUTOREFERER of bool
| CURLOPT_OPENSOCKETFUNCTION of (Unix.file_descr -> unit)
(* | CURLOPT_CLOSESOCKETFUNCTION of (Unix.file_descr -> unit) *)
| CURLOPT_PROXYTYPE of curlProxyType
| CURLOPT_PROTOCOLS of curlProto list
| CURLOPT_REDIR_PROTOCOLS of curlProto list
| CURLOPT_RESOLVE of string list
| CURLOPT_DNS_SERVERS of string
| CURLOPT_MAIL_FROM of string
| CURLOPT_MAIL_RCPT of string list
| CURLOPT_PIPEWAIT of bool
| CURLOPT_CERTINFO of bool
| CURLOPT_USERNAME of string
| CURLOPT_PASSWORD of string
| CURLOPT_LOGIN_OPTIONS of string
| CURLOPT_CONNECT_TO of string list
| CURLOPT_POSTREDIR of curlPostRedir list
| CURLOPT_MIMEPOST of curlMIMEPart list
| CURLOPT_SSHKNOWNHOSTS of string
| CURLOPT_SSHKEYFUNCTION of (curlKHMatch -> string -> curlKHStat)
| CURLOPT_BUFFERSIZE of int
| CURLOPT_DOH_URL of string
| CURLOPT_SSL_OPTIONS of curlSslOption list
| CURLOPT_WRITEFUNCTION2 of (string -> write_result)
| CURLOPT_READFUNCTION2 of (int -> read_result)
| CURLOPT_XFERINFOFUNCTION of (int64 -> int64 -> int64 -> int64 -> bool)
| CURLOPT_PREREQFUNCTION of (string -> string -> int -> int -> bool)
| CURLOPT_AWS_SIGV4 of string
| CURLOPT_TCP_KEEPALIVE of bool
| CURLOPT_TCP_KEEPIDLE of int
| CURLOPT_TCP_KEEPINTVL of int
type initOption =
| CURLINIT_GLOBALALL
| CURLINIT_GLOBALSSL
| CURLINIT_GLOBALWIN32
| CURLINIT_GLOBALNOTHING
type curlInfo =
| CURLINFO_EFFECTIVE_URL
| CURLINFO_HTTP_CODE
| CURLINFO_RESPONSE_CODE
| CURLINFO_TOTAL_TIME
| CURLINFO_NAMELOOKUP_TIME
| CURLINFO_CONNECT_TIME
| CURLINFO_PRETRANSFER_TIME
| CURLINFO_SIZE_UPLOAD
| CURLINFO_SIZE_DOWNLOAD
| CURLINFO_SPEED_DOWNLOAD
| CURLINFO_SPEED_UPLOAD
| CURLINFO_HEADER_SIZE
| CURLINFO_REQUEST_SIZE
| CURLINFO_SSL_VERIFYRESULT
| CURLINFO_FILETIME
| CURLINFO_CONTENT_LENGTH_DOWNLOAD
| CURLINFO_CONTENT_LENGTH_UPLOAD
| CURLINFO_STARTTRANSFER_TIME
| CURLINFO_CONTENT_TYPE
| CURLINFO_REDIRECT_TIME
| CURLINFO_REDIRECT_COUNT
| CURLINFO_PRIVATE
| CURLINFO_HTTP_CONNECTCODE
| CURLINFO_HTTPAUTH_AVAIL
| CURLINFO_PROXYAUTH_AVAIL
| CURLINFO_OS_ERRNO
| CURLINFO_NUM_CONNECTS
| CURLINFO_SSL_ENGINES
| CURLINFO_COOKIELIST
| CURLINFO_LASTSOCKET
| CURLINFO_FTP_ENTRY_PATH
| CURLINFO_REDIRECT_URL
| CURLINFO_PRIMARY_IP
| CURLINFO_LOCAL_IP
| CURLINFO_LOCAL_PORT
| CURLINFO_CONDITION_UNMET
| CURLINFO_CERTINFO
| CURLINFO_ACTIVESOCKET
| CURLINFO_HTTP_VERSION
type curlInfoResult =
| CURLINFO_String of string
| CURLINFO_Long of int
| CURLINFO_Double of float
| CURLINFO_StringList of string list
| CURLINFO_StringListList of string list list
| CURLINFO_Socket of Unix.file_descr
| CURLINFO_Version of curlHTTPVersion
type curlSslBackend =
| CURLSSLBACKEND_NONE
| CURLSSLBACKEND_OPENSSL
| CURLSSLBACKEND_GNUTLS
| CURLSSLBACKEND_NSS
| CURLSSLBACKEND_GSKIT
| CURLSSLBACKEND_WOLFSSL
| CURLSSLBACKEND_SCHANNEL
| CURLSSLBACKEND_SECURETRANSPORT
| CURLSSLBACKEND_MBEDTLS
| CURLSSLBACKEND_MESALINK
| CURLSSLBACKEND_BEARSSL
type curlSslSet =
| CURLSSLSET_OK
| CURLSSLSET_UNKNOWN_BACKEND
| CURLSSLSET_TOO_LATE
| CURLSSLSET_NO_BACKENDS
exception NotImplemented of string
let () = Callback.register_exception "Curl.NotImplemented" (NotImplemented "")
exception CurlSslSetException of curlSslSet
let () =
Callback.register_exception "CurlSslSetException"
(CurlSslSetException CURLSSLSET_OK)
external global_sslset : curlSslBackend -> unit = "caml_curl_global_sslset"
external global_sslset_str : string -> unit = "caml_curl_global_sslset_str"
external global_sslsetavail : unit -> curlSslBackend list = "caml_curl_global_sslsetavail"
external global_sslsetavail_str : unit -> string list = "caml_curl_global_sslsetavail_str"
external global_init : initOption -> unit = "caml_curl_global_init"
external global_cleanup : unit -> unit = "caml_curl_global_cleanup"
external init : unit -> t = "caml_curl_easy_init"
external reset : t -> unit = "caml_curl_easy_reset"
external setopt : t -> curlOption -> unit = "caml_curl_easy_setopt"
external perform : t -> unit = "caml_curl_easy_perform"
external cleanup : t -> unit = "caml_curl_easy_cleanup"
external getinfo : t -> curlInfo -> curlInfoResult = "caml_curl_easy_getinfo"
external escape : string -> string = "caml_curl_escape"
external unescape : string -> string = "caml_curl_unescape"
external getdate : string -> float -> float = "caml_curl_getdate"
external version : unit -> string = "caml_curl_version"
type version_info = {
version : string;
number : int * int * int;
host : string;
features : string list;
ssl_version : string option;
libz_version : string option;
protocols : string list;
ares : string;
ares_num : int;
libidn : string;
iconv_ver_num : int;
libssh_version : string;
}
external version_info : unit -> version_info = "caml_curl_version_info"
external strerror : curlCode -> string = "caml_curl_strerror"
external curlCode_of_int : int -> curlCode option = "caml_curl_curlCode_of_int"
external int_of_curlCode : curlCode -> int = "caml_curl_int_of_curlCode"
let errno = int_of_curlCode
type pauseOption = PAUSE_SEND | PAUSE_RECV | PAUSE_ALL
external pause : t -> pauseOption list -> unit = "caml_curl_pause"
let set_writefunction conn closure =
setopt conn (CURLOPT_WRITEFUNCTION closure)
let set_writefunction2 conn closure =
setopt conn (CURLOPT_WRITEFUNCTION2 closure)
let set_readfunction conn closure =
setopt conn (CURLOPT_READFUNCTION closure)
let set_readfunction2 conn closure =
setopt conn (CURLOPT_READFUNCTION2 closure)
let set_infilesize conn size =
setopt conn (CURLOPT_INFILESIZE size)
let set_url conn url =
setopt conn (CURLOPT_URL url)
let set_proxy conn proxy =
setopt conn (CURLOPT_PROXY proxy)
let set_proxyport conn proxyport =
setopt conn (CURLOPT_PROXYPORT proxyport)
let set_httpproxytunnel conn flag =
setopt conn (CURLOPT_HTTPPROXYTUNNEL flag)
let set_verbose conn flag =
setopt conn (CURLOPT_VERBOSE flag)
let set_header conn flag =
setopt conn (CURLOPT_HEADER flag)
let set_noprogress conn flag =
setopt conn (CURLOPT_NOPROGRESS flag)
let set_nosignal conn flag =
setopt conn (CURLOPT_NOSIGNAL flag)
let set_nobody conn flag =
setopt conn (CURLOPT_NOBODY flag)
let set_failonerror conn flag =
setopt conn (CURLOPT_FAILONERROR flag)
let set_upload conn flag =
setopt conn (CURLOPT_UPLOAD flag)
let set_post conn flag =
setopt conn (CURLOPT_POST flag)
let set_ftplistonly conn flag =
setopt conn (CURLOPT_FTPLISTONLY flag)
let set_ftpappend conn flag =
setopt conn (CURLOPT_FTPAPPEND flag)
let set_netrc conn netrc =
setopt conn (CURLOPT_NETRC netrc)
let set_encoding conn encoding =
setopt conn (CURLOPT_ENCODING encoding)
let set_followlocation conn flag =
setopt conn (CURLOPT_FOLLOWLOCATION flag)
let set_transfertext conn flag =
setopt conn (CURLOPT_TRANSFERTEXT flag)
let set_put conn flag =
setopt conn (CURLOPT_PUT flag)
let set_userpwd conn userpwd =
setopt conn (CURLOPT_USERPWD userpwd)
let set_proxyuserpwd conn proxyuserpwd =
setopt conn (CURLOPT_PROXYUSERPWD proxyuserpwd)
let set_range conn range =
setopt conn (CURLOPT_RANGE range)
let set_errorbuffer conn errorbuffer =
setopt conn (CURLOPT_ERRORBUFFER errorbuffer)
let set_timeout conn timeout =
setopt conn (CURLOPT_TIMEOUT timeout)
let set_postfields conn postfields =
setopt conn (CURLOPT_POSTFIELDS postfields)
let set_postfieldsize conn postfieldsize =
setopt conn (CURLOPT_POSTFIELDSIZE postfieldsize)
let set_referer conn referer =
setopt conn (CURLOPT_REFERER referer)
let set_useragent conn useragent =
setopt conn (CURLOPT_USERAGENT useragent)
let set_ftpport conn ftpport =
setopt conn (CURLOPT_FTPPORT ftpport)
let set_lowspeedlimit conn lowspeedlimit =
setopt conn (CURLOPT_LOWSPEEDLIMIT lowspeedlimit)
let set_lowspeedtime conn lowspeedtime =
setopt conn (CURLOPT_LOWSPEEDTIME lowspeedtime)
let set_resumefrom conn resumefrom =
setopt conn (CURLOPT_RESUMEFROM resumefrom)
let set_cookie conn cookie =
setopt conn (CURLOPT_COOKIE cookie)
let set_httpheader conn httpheader =
setopt conn (CURLOPT_HTTPHEADER httpheader)
let set_httppost conn httppost =
setopt conn (CURLOPT_HTTPPOST httppost)
let set_sslcert conn sslcert =
setopt conn (CURLOPT_SSLCERT sslcert)
let set_sslcerttype conn sslcerttype =
setopt conn (CURLOPT_SSLCERTTYPE sslcerttype)
let set_sslcertpasswd conn sslcertpasswd =
setopt conn (CURLOPT_SSLCERTPASSWD sslcertpasswd)
let set_sslkey conn sslkey =
setopt conn (CURLOPT_SSLKEY sslkey)
let set_sslkeytype conn sslkeytype =
setopt conn (CURLOPT_SSLKEYTYPE sslkeytype)
let set_sslkeypasswd conn sslkeypasswd =
setopt conn (CURLOPT_SSLKEYPASSWD sslkeypasswd)
let set_sslengine conn sslengine =
setopt conn (CURLOPT_SSLENGINE sslengine)
let set_sslenginedefault conn flag =
setopt conn (CURLOPT_SSLENGINEDEFAULT flag)
let set_certinfo conn flag =
setopt conn (CURLOPT_CERTINFO flag)
let set_crlf conn flag =
setopt conn (CURLOPT_CRLF flag)
let set_quote conn quote =
setopt conn (CURLOPT_QUOTE quote)
let set_postquote conn postquote =
setopt conn (CURLOPT_POSTQUOTE postquote)
let set_headerfunction conn closure =
setopt conn (CURLOPT_HEADERFUNCTION closure)
let set_cookiefile conn cookiefile =
setopt conn (CURLOPT_COOKIEFILE cookiefile)
let set_sslversion conn sslversion =
setopt conn (CURLOPT_SSLVERSION sslversion)
let set_timecondition conn timecondition =
setopt conn (CURLOPT_TIMECONDITION timecondition)
let set_timevalue conn timevalue =
setopt conn (CURLOPT_TIMEVALUE timevalue)
let set_customrequest conn customrequest =
setopt conn (CURLOPT_CUSTOMREQUEST customrequest)
let set_interface conn interface =
setopt conn (CURLOPT_INTERFACE interface)
let set_krb4level conn krb4level =
setopt conn (CURLOPT_KRB4LEVEL krb4level)
let set_progressfunction conn closure =
setopt conn (CURLOPT_PROGRESSFUNCTION closure)
let set_xferinfofunction conn closure =
setopt conn (CURLOPT_XFERINFOFUNCTION closure)
let set_prereqfunction conn closure =
setopt conn (CURLOPT_PREREQFUNCTION closure)
let set_sslverifypeer conn flag =
setopt conn (CURLOPT_SSLVERIFYPEER flag)
let set_cainfo conn cainfo =
setopt conn (CURLOPT_CAINFO cainfo)
let set_capath conn capath =
setopt conn (CURLOPT_CAPATH capath)
let set_filetime conn filetime =
setopt conn (CURLOPT_FILETIME filetime)
let set_maxredirs conn maxredirs =
setopt conn (CURLOPT_MAXREDIRS maxredirs)
let set_maxconnects conn maxconnects =
setopt conn (CURLOPT_MAXCONNECTS maxconnects)
let set_closepolicy conn closepolicy =
setopt conn (CURLOPT_CLOSEPOLICY closepolicy)
let set_freshconnect conn flag =
setopt conn (CURLOPT_FRESHCONNECT flag)
let set_forbidreuse conn flag =
setopt conn (CURLOPT_FORBIDREUSE flag)
let set_randomfile conn randomfile =
setopt conn (CURLOPT_RANDOMFILE randomfile)
let set_egdsocket conn egdsocket =
setopt conn (CURLOPT_EGDSOCKET egdsocket)
let set_connecttimeout conn connecttimeout =
setopt conn (CURLOPT_CONNECTTIMEOUT connecttimeout)
let set_httpget conn flag =
setopt conn (CURLOPT_HTTPGET flag)
let set_sslverifyhost conn sslverifyhost =
setopt conn (CURLOPT_SSLVERIFYHOST sslverifyhost)
let set_cookiejar conn cookiejar =
setopt conn (CURLOPT_COOKIEJAR cookiejar)
let set_sslcipherlist conn sslcipherlist =
setopt conn (CURLOPT_SSLCIPHERLIST sslcipherlist)
let set_httpversion conn httpversion =
setopt conn (CURLOPT_HTTPVERSION httpversion)
let set_ftpuseepsv conn flag =
setopt conn (CURLOPT_FTPUSEEPSV flag)
let set_dnscachetimeout conn dnscachetimeout =
setopt conn (CURLOPT_DNSCACHETIMEOUT dnscachetimeout)
let set_dnsuseglobalcache conn flag =
setopt conn (CURLOPT_DNSUSEGLOBALCACHE flag)
let set_debugfunction conn closure =
setopt conn (CURLOPT_DEBUGFUNCTION closure)
let set_private conn privateData =
setopt conn (CURLOPT_PRIVATE privateData)
let set_http200aliases conn aliases =
setopt conn (CURLOPT_HTTP200ALIASES aliases)
let set_unrestrictedauth conn flag =
setopt conn (CURLOPT_UNRESTRICTEDAUTH flag)
let set_ftpuseeprt conn flag =
setopt conn (CURLOPT_FTPUSEEPRT flag)
let set_httpauth conn auth =
setopt conn (CURLOPT_HTTPAUTH auth)
let set_ftpcreatemissingdirs conn flag =
setopt conn (CURLOPT_FTPCREATEMISSINGDIRS flag)
let set_proxyauth conn auth =
setopt conn (CURLOPT_PROXYAUTH auth)
let set_ftpresponsetimeout conn timeout =
setopt conn (CURLOPT_FTPRESPONSETIMEOUT timeout)
let set_ipresolve conn ipresolve =
setopt conn (CURLOPT_IPRESOLVE ipresolve)
let set_maxfilesize conn size =
setopt conn (CURLOPT_MAXFILESIZE size)
let set_infilesizelarge conn size =
setopt conn (CURLOPT_INFILESIZELARGE size)
let set_resumefromlarge conn size =
setopt conn (CURLOPT_RESUMEFROMLARGE size)
let set_maxfilesizelarge conn size =
setopt conn (CURLOPT_MAXFILESIZELARGE size)
let set_netrcfile conn file =
setopt conn (CURLOPT_NETRCFILE file)
let set_ftpssl conn ftpssl =
setopt conn (CURLOPT_FTPSSL ftpssl)
let set_postfieldsizelarge conn size =
setopt conn (CURLOPT_POSTFIELDSIZELARGE size)
let set_tcpnodelay conn flag =
setopt conn (CURLOPT_TCPNODELAY flag)
let set_tcpfastopen conn flag =
setopt conn (CURLOPT_TCP_FASTOPEN flag)
let set_tcpkeepalive conn flag =
setopt conn (CURLOPT_TCP_KEEPALIVE flag)
let set_tcpkeepidle conn seconds =
setopt conn (CURLOPT_TCP_KEEPIDLE seconds)
let set_tcpkeepintvl conn seconds =
setopt conn (CURLOPT_TCP_KEEPINTVL seconds)
let set_ftpsslauth conn auth =
setopt conn (CURLOPT_FTPSSLAUTH auth)
let set_ioctlfunction conn closure =
setopt conn (CURLOPT_IOCTLFUNCTION closure)
let set_ftpaccount conn account =
setopt conn (CURLOPT_FTPACCOUNT account)
let set_cookielist conn cookielist =
setopt conn (CURLOPT_COOKIELIST cookielist)
let set_ignorecontentlength conn flag =
setopt conn (CURLOPT_IGNORECONTENTLENGTH flag)
let set_ftpskippasvip conn flag =
setopt conn (CURLOPT_FTPSKIPPASVIP flag)
let set_ftpfilemethod conn ftpMethod =
setopt conn (CURLOPT_FTPFILEMETHOD ftpMethod)
let set_localport conn port =
setopt conn (CURLOPT_LOCALPORT port)
let set_localportrange conn range =
setopt conn (CURLOPT_LOCALPORTRANGE range)
let set_connectonly conn flag =
setopt conn (CURLOPT_CONNECTONLY flag)
let set_maxsendspeedlarge conn speed =
setopt conn (CURLOPT_MAXSENDSPEEDLARGE speed)
let set_maxrecvspeedlarge conn speed =
setopt conn (CURLOPT_MAXRECVSPEEDLARGE speed)
let set_ftpalternativetouser conn user =
setopt conn (CURLOPT_FTPALTERNATIVETOUSER user)
let set_sslsessionidcache conn flag =
setopt conn (CURLOPT_SSLSESSIONIDCACHE flag)
let set_sshauthtypes conn types =
setopt conn (CURLOPT_SSHAUTHTYPES types)
let set_sshpublickeyfile conn keyfile =
setopt conn (CURLOPT_SSHPUBLICKEYFILE keyfile)
let set_sshprivatekeyfile conn keyfile =
setopt conn (CURLOPT_SSHPRIVATEKEYFILE keyfile)
let set_ftpsslccc conn ccc =
setopt conn (CURLOPT_FTPSSLCCC ccc)
let set_timeoutms conn ms =
setopt conn (CURLOPT_TIMEOUTMS ms)