Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/src/tool_cfgable.h
2649 views
1
#ifndef HEADER_CURL_TOOL_CFGABLE_H
2
#define HEADER_CURL_TOOL_CFGABLE_H
3
/***************************************************************************
4
* _ _ ____ _
5
* Project ___| | | | _ \| |
6
* / __| | | | |_) | |
7
* | (__| |_| | _ <| |___
8
* \___|\___/|_| \_\_____|
9
*
10
* Copyright (C) Daniel Stenberg, <[email protected]>, et al.
11
*
12
* This software is licensed as described in the file COPYING, which
13
* you should have received as part of this distribution. The terms
14
* are also available at https://curl.se/docs/copyright.html.
15
*
16
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
* copies of the Software, and permit persons to whom the Software is
18
* furnished to do so, under the terms of the COPYING file.
19
*
20
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
* KIND, either express or implied.
22
*
23
* SPDX-License-Identifier: curl
24
*
25
***************************************************************************/
26
27
#include <curl/mprintf.h>
28
#include "tool_setup.h"
29
#include "tool_sdecls.h"
30
#include "tool_urlglob.h"
31
#include "var.h"
32
33
/* the type we use for storing a single boolean bit */
34
#ifndef BIT
35
#ifdef _MSC_VER
36
#define BIT(x) bool x
37
#else
38
#define BIT(x) unsigned int x:1
39
#endif
40
#endif
41
42
#define checkprefix(a,b) curl_strnequal(b, STRCONST(a))
43
44
#define tool_safefree(ptr) \
45
do { free((ptr)); (ptr) = NULL;} while(0)
46
47
extern struct GlobalConfig *global;
48
49
struct State {
50
struct getout *urlnode;
51
struct URLGlob inglob;
52
struct URLGlob urlglob;
53
char *httpgetfields;
54
char *uploadfile;
55
curl_off_t upnum; /* number of files to upload */
56
curl_off_t upidx; /* index for upload glob */
57
curl_off_t urlnum; /* how many iterations this URL has with ranges etc */
58
curl_off_t urlidx; /* index for globbed URLs */
59
};
60
61
#define FAIL_NONE 0
62
#define FAIL_WITH_BODY 1
63
#define FAIL_WO_BODY 2
64
65
struct OperationConfig {
66
struct dynbuf postdata;
67
char *useragent;
68
struct curl_slist *cookies; /* cookies to serialize into a single line */
69
char *cookiejar; /* write to this file */
70
struct curl_slist *cookiefiles; /* file(s) to load cookies from */
71
char *altsvc; /* alt-svc cache filename */
72
char *hsts; /* HSTS cache filename */
73
char *proto_str;
74
char *proto_redir_str;
75
char *proto_default;
76
curl_off_t resume_from;
77
char *postfields;
78
char *referer;
79
char *query;
80
curl_off_t max_filesize;
81
char *output_dir;
82
char *headerfile;
83
char *ftpport;
84
char *iface;
85
char *range;
86
char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */
87
char *dns_interface; /* interface name */
88
char *dns_ipv4_addr; /* dot notation */
89
char *dns_ipv6_addr; /* dot notation */
90
char *userpwd;
91
char *login_options;
92
char *tls_username;
93
char *tls_password;
94
char *tls_authtype;
95
char *proxy_tls_username;
96
char *proxy_tls_password;
97
char *proxy_tls_authtype;
98
char *proxyuserpwd;
99
char *proxy;
100
char *noproxy;
101
char *knownhosts;
102
char *mail_from;
103
struct curl_slist *mail_rcpt;
104
char *mail_auth;
105
char *sasl_authzid; /* Authorization identity (identity to use) */
106
char *netrc_file;
107
struct getout *url_list; /* point to the first node */
108
struct getout *url_last; /* point to the last/current node */
109
struct getout *url_get; /* point to the node to fill in URL */
110
struct getout *url_out; /* point to the node to fill in outfile */
111
struct getout *url_ul; /* point to the node to fill in upload */
112
size_t num_urls; /* number of URLs added to the list */
113
#ifndef CURL_DISABLE_IPFS
114
char *ipfs_gateway;
115
#endif /* !CURL_DISABLE_IPFS */
116
char *doh_url;
117
char *cipher_list;
118
char *proxy_cipher_list;
119
char *cipher13_list;
120
char *proxy_cipher13_list;
121
char *cert;
122
char *proxy_cert;
123
char *cert_type;
124
char *proxy_cert_type;
125
char *cacert;
126
char *proxy_cacert;
127
char *capath;
128
char *proxy_capath;
129
char *crlfile;
130
char *proxy_crlfile;
131
char *pinnedpubkey;
132
char *proxy_pinnedpubkey;
133
char *key;
134
char *proxy_key;
135
char *key_type;
136
char *proxy_key_type;
137
char *key_passwd;
138
char *proxy_key_passwd;
139
char *pubkey;
140
char *hostpubmd5;
141
char *hostpubsha256;
142
char *engine;
143
char *etag_save_file;
144
char *etag_compare_file;
145
char *customrequest;
146
char *ssl_ec_curves;
147
char *ssl_signature_algorithms;
148
char *krblevel;
149
char *request_target;
150
char *writeout; /* %-styled format string to output */
151
struct curl_slist *quote;
152
struct curl_slist *postquote;
153
struct curl_slist *prequote;
154
struct curl_slist *headers;
155
struct curl_slist *proxyheaders;
156
struct tool_mime *mimeroot;
157
struct tool_mime *mimecurrent;
158
curl_mime *mimepost;
159
struct curl_slist *telnet_options;
160
struct curl_slist *resolve;
161
struct curl_slist *connect_to;
162
char *preproxy;
163
char *proxy_service_name; /* set authentication service name for HTTP and
164
SOCKS5 proxies */
165
char *service_name; /* set authentication service name for DIGEST-MD5,
166
Kerberos 5 and SPNEGO */
167
char *ftp_account; /* for ACCT */
168
char *ftp_alternative_to_user; /* send command if USER/PASS fails */
169
char *oauth_bearer; /* OAuth 2.0 bearer token */
170
char *unix_socket_path; /* path to Unix domain socket */
171
char *haproxy_clientip; /* client IP for HAProxy protocol */
172
char *aws_sigv4;
173
char *ech; /* Config set by --ech keywords */
174
char *ech_config; /* Config set by "--ech esl:" option */
175
char *ech_public; /* Config set by "--ech pn:" option */
176
struct OperationConfig *prev;
177
struct OperationConfig *next; /* Always last in the struct */
178
curl_off_t condtime;
179
/* for bandwidth limiting features: */
180
curl_off_t sendpersecond; /* send to peer */
181
curl_off_t recvpersecond; /* receive from peer */
182
183
long proxy_ssl_version;
184
long ip_version;
185
long create_file_mode; /* CURLOPT_NEW_FILE_PERMS */
186
long low_speed_limit;
187
long low_speed_time;
188
long ip_tos; /* IP Type of Service */
189
long vlan_priority; /* VLAN priority */
190
long localport;
191
long localportrange;
192
unsigned long authtype; /* auth bitmask */
193
long timeout_ms;
194
long connecttimeout_ms;
195
long maxredirs;
196
long httpversion;
197
unsigned long socks5_auth;/* auth bitmask for socks5 proxies */
198
long req_retry; /* number of retries */
199
long retry_delay_ms; /* delay between retries (in milliseconds),
200
0 means increase exponentially */
201
long retry_maxtime_ms; /* maximum time to keep retrying */
202
203
unsigned long mime_options; /* Mime option flags. */
204
long tftp_blksize; /* TFTP BLKSIZE option */
205
long alivetime; /* keepalive-time */
206
long alivecnt; /* keepalive-cnt */
207
long gssapi_delegation;
208
long expect100timeout_ms;
209
long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
210
0 is valid. default: CURL_HET_DEFAULT. */
211
unsigned long timecond;
212
long followlocation; /* follow http redirects mode */
213
HttpReq httpreq;
214
long proxyver; /* set to CURLPROXY_HTTP* define */
215
long ftp_ssl_ccc_mode;
216
long ftp_filemethod;
217
enum {
218
CLOBBER_DEFAULT, /* Provides compatibility with previous versions of curl,
219
by using the default behavior for -o, -O, and -J.
220
If those options would have overwritten files, like
221
-o and -O would, then overwrite them. In the case of
222
-J, this will not overwrite any files. */
223
CLOBBER_NEVER, /* If the file exists, always fail */
224
CLOBBER_ALWAYS /* If the file exists, always overwrite it */
225
} file_clobber_mode;
226
unsigned char upload_flags; /* Bitmask for --upload-flags */
227
unsigned short porttouse;
228
unsigned char ssl_version; /* 0 - 4, 0 being default */
229
unsigned char ssl_version_max; /* 0 - 4, 0 being default */
230
unsigned char fail; /* NONE, with body, without body */
231
BIT(remote_name_all); /* --remote-name-all */
232
BIT(remote_time);
233
BIT(cookiesession); /* new session? */
234
BIT(encoding); /* Accept-Encoding please */
235
BIT(tr_encoding); /* Transfer-Encoding please */
236
BIT(use_resume);
237
BIT(resume_from_current);
238
BIT(disable_epsv);
239
BIT(disable_eprt);
240
BIT(ftp_pret);
241
BIT(proto_present);
242
BIT(proto_redir_present);
243
BIT(mail_rcpt_allowfails); /* --mail-rcpt-allowfails */
244
BIT(sasl_ir); /* Enable/disable SASL initial response */
245
BIT(proxytunnel);
246
BIT(ftp_append); /* APPE on ftp */
247
BIT(use_ascii); /* select ASCII or text transfer */
248
BIT(autoreferer); /* automatically set referer */
249
BIT(show_headers); /* show headers to data output */
250
BIT(no_body); /* do not get the body */
251
BIT(dirlistonly); /* only get the FTP dir list */
252
BIT(unrestricted_auth); /* Continue to send authentication (user+password)
253
when following redirects, even when hostname
254
changed */
255
BIT(netrc_opt);
256
BIT(netrc);
257
BIT(crlf);
258
BIT(http09_allowed);
259
BIT(nobuffer);
260
BIT(readbusy); /* set when reading input returns EAGAIN */
261
BIT(globoff);
262
BIT(use_httpget);
263
BIT(insecure_ok); /* set TRUE to allow insecure SSL connects */
264
BIT(doh_insecure_ok); /* set TRUE to allow insecure SSL connects
265
for DoH */
266
BIT(proxy_insecure_ok); /* set TRUE to allow insecure SSL connects
267
for proxy */
268
BIT(terminal_binary_ok);
269
BIT(verifystatus);
270
BIT(doh_verifystatus);
271
BIT(create_dirs);
272
BIT(ftp_create_dirs);
273
BIT(ftp_skip_ip);
274
BIT(proxynegotiate);
275
BIT(proxyntlm);
276
BIT(proxydigest);
277
BIT(proxybasic);
278
BIT(proxyanyauth);
279
BIT(jsoned); /* added json content-type */
280
BIT(ftp_ssl);
281
BIT(ftp_ssl_reqd);
282
BIT(ftp_ssl_control);
283
BIT(ftp_ssl_ccc);
284
BIT(socks5_gssapi_nec); /* The NEC reference server does not protect the
285
encryption type exchange */
286
BIT(tcp_nodelay);
287
BIT(tcp_fastopen);
288
BIT(retry_all_errors); /* retry on any error */
289
BIT(retry_connrefused); /* set connection refused as a transient error */
290
BIT(tftp_no_options); /* do not send TFTP options requests */
291
BIT(ignorecl); /* --ignore-content-length */
292
BIT(disable_sessionid);
293
294
BIT(raw);
295
BIT(post301);
296
BIT(post302);
297
BIT(post303);
298
BIT(nokeepalive); /* for keepalive needs */
299
BIT(content_disposition); /* use Content-disposition filename */
300
301
BIT(xattr); /* store metadata in extended attributes */
302
BIT(ssl_allow_beast); /* allow this SSL vulnerability */
303
BIT(ssl_allow_earlydata); /* allow use of TLSv1.3 early data */
304
BIT(proxy_ssl_allow_beast); /* allow this SSL vulnerability for proxy */
305
BIT(ssl_no_revoke); /* disable SSL certificate revocation checks */
306
BIT(ssl_revoke_best_effort); /* ignore SSL revocation offline/missing
307
revocation list errors */
308
309
BIT(native_ca_store); /* use the native OS CA store */
310
BIT(proxy_native_ca_store); /* use the native OS CA store for proxy */
311
BIT(ssl_auto_client_cert); /* automatically locate and use a client
312
certificate for authentication (Schannel) */
313
BIT(proxy_ssl_auto_client_cert); /* proxy version of ssl_auto_client_cert */
314
BIT(noalpn); /* enable/disable TLS ALPN extension */
315
BIT(abstract_unix_socket); /* path to an abstract Unix domain socket */
316
BIT(path_as_is);
317
BIT(suppress_connect_headers); /* suppress proxy CONNECT response headers
318
from user callbacks */
319
BIT(synthetic_error); /* if TRUE, this is tool-internal error */
320
BIT(ssh_compression); /* enable/disable SSH compression */
321
BIT(haproxy_protocol); /* whether to send HAProxy protocol v1 */
322
BIT(disallow_username_in_url); /* disallow usernames in URLs */
323
BIT(mptcp); /* enable MPTCP support */
324
BIT(rm_partial); /* on error, remove partially written output
325
files */
326
BIT(skip_existing);
327
};
328
329
#if defined(_WIN32) && !defined(UNDER_CE)
330
struct termout {
331
wchar_t *buf;
332
DWORD len;
333
};
334
#endif
335
336
struct GlobalConfig {
337
struct State state; /* for create_transfer() */
338
char *trace_dump; /* file to dump the network trace to */
339
FILE *trace_stream;
340
char *libcurl; /* Output libcurl code to this filename */
341
char *ssl_sessions; /* file to load/save SSL session tickets */
342
struct tool_var *variables;
343
struct OperationConfig *first;
344
struct OperationConfig *current;
345
struct OperationConfig *last;
346
#if defined(_WIN32) && !defined(UNDER_CE)
347
struct termout term;
348
#endif
349
timediff_t ms_per_transfer; /* start next transfer after (at least) this
350
many milliseconds */
351
trace tracetype;
352
int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
353
unsigned short parallel_host; /* MAX_PARALLEL_HOST is the maximum */
354
unsigned short parallel_max; /* MAX_PARALLEL is the maximum */
355
unsigned char verbosity; /* How verbose we should be */
356
#ifdef DEBUGBUILD
357
BIT(test_duphandle);
358
BIT(test_event_based);
359
#endif
360
BIT(parallel);
361
BIT(parallel_connect);
362
BIT(fail_early); /* exit on first transfer error */
363
BIT(styled_output); /* enable fancy output style detection */
364
BIT(trace_fopened);
365
BIT(tracetime); /* include timestamp? */
366
BIT(traceids); /* include xfer-/conn-id? */
367
BIT(showerror); /* show errors when silent */
368
BIT(silent); /* do not show messages, --silent given */
369
BIT(noprogress); /* do not show progress bar */
370
BIT(isatty); /* Updated internally if output is a tty */
371
BIT(trace_set); /* --trace-config has been used */
372
};
373
374
struct OperationConfig *config_alloc(void);
375
void config_free(struct OperationConfig *config);
376
CURLcode globalconf_init(void);
377
void globalconf_free(void);
378
379
#endif /* HEADER_CURL_TOOL_CFGABLE_H */
380
381