| 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) 1998 - 2020, 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.haxx.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 |
***************************************************************************/ |
| 24 |
#include "tool_setup.h" |
| 25 |
#include "tool_sdecls.h" |
| 26 |
#include "tool_metalink.h" |
| 27 |
#include "tool_urlglob.h" |
| 28 |
#include "tool_formparse.h" |
| 29 |
|
| 30 |
typedef enum { |
| 31 |
ERR_NONE, |
| 32 |
ERR_BINARY_TERMINAL = 1, /* binary to terminal detected */ |
| 33 |
ERR_LAST |
| 34 |
} curl_error; |
| 35 |
|
| 36 |
struct GlobalConfig; |
| 37 |
|
| 38 |
struct State { |
| 39 |
struct getout *urlnode; |
| 40 |
URLGlob *inglob; |
| 41 |
URLGlob *urls; |
| 42 |
char *outfiles; |
| 43 |
char *httpgetfields; |
| 44 |
char *uploadfile; |
| 45 |
unsigned long infilenum; /* number of files to upload */ |
| 46 |
unsigned long up; /* upload file counter within a single upload glob */ |
| 47 |
unsigned long urlnum; /* how many iterations this single URL has with ranges |
| 48 |
etc */ |
| 49 |
unsigned long li; |
| 50 |
}; |
| 51 |
|
| 52 |
struct OperationConfig { |
| 53 |
bool remote_time; |
| 54 |
char *random_file; |
| 55 |
char *egd_file; |
| 56 |
char *useragent; |
| 57 |
char *cookie; /* single line with specified cookies */ |
| 58 |
char *cookiejar; /* write to this file */ |
| 59 |
char *cookiefile; /* read from this file */ |
| 60 |
char *altsvc; /* alt-svc cache file name */ |
| 61 |
bool cookiesession; /* new session? */ |
| 62 |
bool encoding; /* Accept-Encoding please */ |
| 63 |
bool tr_encoding; /* Transfer-Encoding please */ |
| 64 |
unsigned long authtype; /* auth bitmask */ |
| 65 |
bool use_resume; |
| 66 |
bool resume_from_current; |
| 67 |
bool disable_epsv; |
| 68 |
bool disable_eprt; |
| 69 |
bool ftp_pret; |
| 70 |
long proto; |
| 71 |
bool proto_present; |
| 72 |
long proto_redir; |
| 73 |
bool proto_redir_present; |
| 74 |
char *proto_default; |
| 75 |
curl_off_t resume_from; |
| 76 |
char *postfields; |
| 77 |
curl_off_t postfieldsize; |
| 78 |
char *referer; |
| 79 |
double timeout; |
| 80 |
double connecttimeout; |
| 81 |
long maxredirs; |
| 82 |
curl_off_t max_filesize; |
| 83 |
char *headerfile; |
| 84 |
char *ftpport; |
| 85 |
char *iface; |
| 86 |
long localport; |
| 87 |
long localportrange; |
| 88 |
unsigned short porttouse; |
| 89 |
char *range; |
| 90 |
long low_speed_limit; |
| 91 |
long low_speed_time; |
| 92 |
char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */ |
| 93 |
char *dns_interface; /* interface name */ |
| 94 |
char *dns_ipv4_addr; /* dot notation */ |
| 95 |
char *dns_ipv6_addr; /* dot notation */ |
| 96 |
char *userpwd; |
| 97 |
char *login_options; |
| 98 |
char *tls_username; |
| 99 |
char *tls_password; |
| 100 |
char *tls_authtype; |
| 101 |
char *proxy_tls_username; |
| 102 |
char *proxy_tls_password; |
| 103 |
char *proxy_tls_authtype; |
| 104 |
char *proxyuserpwd; |
| 105 |
char *proxy; |
| 106 |
int proxyver; /* set to CURLPROXY_HTTP* define */ |
| 107 |
char *noproxy; |
| 108 |
char *mail_from; |
| 109 |
struct curl_slist *mail_rcpt; |
| 110 |
char *mail_auth; |
| 111 |
bool mail_rcpt_allowfails; /* --mail-rcpt-allowfails */ |
| 112 |
char *sasl_authzid; /* Authorisation identity (identity to use) */ |
| 113 |
bool sasl_ir; /* Enable/disable SASL initial response */ |
| 114 |
bool proxytunnel; |
| 115 |
bool ftp_append; /* APPE on ftp */ |
| 116 |
bool use_ascii; /* select ascii or text transfer */ |
| 117 |
bool autoreferer; /* automatically set referer */ |
| 118 |
bool failonerror; /* fail on (HTTP) errors */ |
| 119 |
bool show_headers; /* show headers to data output */ |
| 120 |
bool no_body; /* don't get the body */ |
| 121 |
bool dirlistonly; /* only get the FTP dir list */ |
| 122 |
bool followlocation; /* follow http redirects */ |
| 123 |
bool unrestricted_auth; /* Continue to send authentication (user+password) |
| 124 |
when following ocations, even when hostname |
| 125 |
changed */ |
| 126 |
bool netrc_opt; |
| 127 |
bool netrc; |
| 128 |
char *netrc_file; |
| 129 |
struct getout *url_list; /* point to the first node */ |
| 130 |
struct getout *url_last; /* point to the last/current node */ |
| 131 |
struct getout *url_get; /* point to the node to fill in URL */ |
| 132 |
struct getout *url_out; /* point to the node to fill in outfile */ |
| 133 |
struct getout *url_ul; /* point to the node to fill in upload */ |
| 134 |
char *doh_url; |
| 135 |
char *cipher_list; |
| 136 |
char *proxy_cipher_list; |
| 137 |
char *cipher13_list; |
| 138 |
char *proxy_cipher13_list; |
| 139 |
char *cert; |
| 140 |
char *proxy_cert; |
| 141 |
char *cert_type; |
| 142 |
char *proxy_cert_type; |
| 143 |
char *cacert; |
| 144 |
char *proxy_cacert; |
| 145 |
char *capath; |
| 146 |
char *proxy_capath; |
| 147 |
char *crlfile; |
| 148 |
char *proxy_crlfile; |
| 149 |
char *pinnedpubkey; |
| 150 |
char *proxy_pinnedpubkey; |
| 151 |
char *key; |
| 152 |
char *proxy_key; |
| 153 |
char *key_type; |
| 154 |
char *proxy_key_type; |
| 155 |
char *key_passwd; |
| 156 |
char *proxy_key_passwd; |
| 157 |
char *pubkey; |
| 158 |
char *hostpubmd5; |
| 159 |
char *engine; |
| 160 |
char *etag_save_file; |
| 161 |
char *etag_compare_file; |
| 162 |
bool crlf; |
| 163 |
char *customrequest; |
| 164 |
char *krblevel; |
| 165 |
char *request_target; |
| 166 |
long httpversion; |
| 167 |
bool http09_allowed; |
| 168 |
bool nobuffer; |
| 169 |
bool readbusy; /* set when reading input returns EAGAIN */ |
| 170 |
bool globoff; |
| 171 |
bool use_httpget; |
| 172 |
bool insecure_ok; /* set TRUE to allow insecure SSL connects */ |
| 173 |
bool proxy_insecure_ok; /* set TRUE to allow insecure SSL connects |
| 174 |
for proxy */ |
| 175 |
bool terminal_binary_ok; |
| 176 |
bool verifystatus; |
| 177 |
bool create_dirs; |
| 178 |
bool ftp_create_dirs; |
| 179 |
bool ftp_skip_ip; |
| 180 |
bool proxynegotiate; |
| 181 |
bool proxyntlm; |
| 182 |
bool proxydigest; |
| 183 |
bool proxybasic; |
| 184 |
bool proxyanyauth; |
| 185 |
char *writeout; /* %-styled format string to output */ |
| 186 |
struct curl_slist *quote; |
| 187 |
struct curl_slist *postquote; |
| 188 |
struct curl_slist *prequote; |
| 189 |
long ssl_version; |
| 190 |
long ssl_version_max; |
| 191 |
long proxy_ssl_version; |
| 192 |
long ip_version; |
| 193 |
curl_TimeCond timecond; |
| 194 |
curl_off_t condtime; |
| 195 |
struct curl_slist *headers; |
| 196 |
struct curl_slist *proxyheaders; |
| 197 |
tool_mime *mimeroot; |
| 198 |
tool_mime *mimecurrent; |
| 199 |
curl_mime *mimepost; |
| 200 |
struct curl_slist *telnet_options; |
| 201 |
struct curl_slist *resolve; |
| 202 |
struct curl_slist *connect_to; |
| 203 |
HttpReq httpreq; |
| 204 |
|
| 205 |
/* for bandwidth limiting features: */ |
| 206 |
curl_off_t sendpersecond; /* send to peer */ |
| 207 |
curl_off_t recvpersecond; /* receive from peer */ |
| 208 |
|
| 209 |
bool ftp_ssl; |
| 210 |
bool ftp_ssl_reqd; |
| 211 |
bool ftp_ssl_control; |
| 212 |
bool ftp_ssl_ccc; |
| 213 |
int ftp_ssl_ccc_mode; |
| 214 |
char *preproxy; |
| 215 |
int socks5_gssapi_nec; /* The NEC reference server does not protect the |
| 216 |
encryption type exchange */ |
| 217 |
unsigned long socks5_auth;/* auth bitmask for socks5 proxies */ |
| 218 |
char *proxy_service_name; /* set authentication service name for HTTP and |
| 219 |
SOCKS5 proxies */ |
| 220 |
char *service_name; /* set authentication service name for DIGEST-MD5, |
| 221 |
Kerberos 5 and SPNEGO */ |
| 222 |
|
| 223 |
bool tcp_nodelay; |
| 224 |
bool tcp_fastopen; |
| 225 |
long req_retry; /* number of retries */ |
| 226 |
bool retry_connrefused; /* set connection refused as a transient error */ |
| 227 |
long retry_delay; /* delay between retries (in seconds) */ |
| 228 |
long retry_maxtime; /* maximum time to keep retrying */ |
| 229 |
|
| 230 |
char *ftp_account; /* for ACCT */ |
| 231 |
char *ftp_alternative_to_user; /* send command if USER/PASS fails */ |
| 232 |
int ftp_filemethod; |
| 233 |
long tftp_blksize; /* TFTP BLKSIZE option */ |
| 234 |
bool tftp_no_options; /* do not send TFTP options requests */ |
| 235 |
bool ignorecl; /* --ignore-content-length */ |
| 236 |
bool disable_sessionid; |
| 237 |
|
| 238 |
bool raw; |
| 239 |
bool post301; |
| 240 |
bool post302; |
| 241 |
bool post303; |
| 242 |
bool nokeepalive; /* for keepalive needs */ |
| 243 |
long alivetime; |
| 244 |
bool content_disposition; /* use Content-disposition filename */ |
| 245 |
|
| 246 |
int default_node_flags; /* default flags to search for each 'node', which |
| 247 |
is basically each given URL to transfer */ |
| 248 |
|
| 249 |
bool xattr; /* store metadata in extended attributes */ |
| 250 |
long gssapi_delegation; |
| 251 |
bool ssl_allow_beast; /* allow this SSL vulnerability */ |
| 252 |
bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy*/ |
| 253 |
|
| 254 |
bool ssl_no_revoke; /* disable SSL certificate revocation checks */ |
| 255 |
/*bool proxy_ssl_no_revoke; */ |
| 256 |
|
| 257 |
bool use_metalink; /* process given URLs as metalink XML file */ |
| 258 |
metalinkfile *metalinkfile_list; /* point to the first node */ |
| 259 |
metalinkfile *metalinkfile_last; /* point to the last/current node */ |
| 260 |
char *oauth_bearer; /* OAuth 2.0 bearer token */ |
| 261 |
bool nonpn; /* enable/disable TLS NPN extension */ |
| 262 |
bool noalpn; /* enable/disable TLS ALPN extension */ |
| 263 |
char *unix_socket_path; /* path to Unix domain socket */ |
| 264 |
bool abstract_unix_socket; /* path to an abstract Unix domain socket */ |
| 265 |
bool falsestart; |
| 266 |
bool path_as_is; |
| 267 |
double expect100timeout; |
| 268 |
bool suppress_connect_headers; /* suppress proxy CONNECT response headers |
| 269 |
from user callbacks */ |
| 270 |
curl_error synthetic_error; /* if non-zero, it overrides any libcurl |
| 271 |
error */ |
| 272 |
bool ssh_compression; /* enable/disable SSH compression */ |
| 273 |
long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds. |
| 274 |
0 is valid. default: CURL_HET_DEFAULT. */ |
| 275 |
bool haproxy_protocol; /* whether to send HAProxy protocol v1 */ |
| 276 |
bool disallow_username_in_url; /* disallow usernames in URLs */ |
| 277 |
struct GlobalConfig *global; |
| 278 |
struct OperationConfig *prev; |
| 279 |
struct OperationConfig *next; /* Always last in the struct */ |
| 280 |
struct State state; /* for create_transfer() */ |
| 281 |
}; |
| 282 |
|
| 283 |
struct GlobalConfig { |
| 284 |
int showerror; /* -1 == unset, default => show errors |
| 285 |
0 => -s is used to NOT show errors |
| 286 |
1 => -S has been used to show errors */ |
| 287 |
bool mute; /* don't show messages, --silent given */ |
| 288 |
bool noprogress; /* don't show progress bar --silent given */ |
| 289 |
bool isatty; /* Updated internally if output is a tty */ |
| 290 |
FILE *errors; /* Error stream, defaults to stderr */ |
| 291 |
bool errors_fopened; /* Whether error stream isn't stderr */ |
| 292 |
char *trace_dump; /* file to dump the network trace to */ |
| 293 |
FILE *trace_stream; |
| 294 |
bool trace_fopened; |
| 295 |
trace tracetype; |
| 296 |
bool tracetime; /* include timestamp? */ |
| 297 |
int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */ |
| 298 |
char *libcurl; /* Output libcurl code to this file name */ |
| 299 |
bool fail_early; /* exit on first transfer error */ |
| 300 |
bool styled_output; /* enable fancy output style detection */ |
| 301 |
#ifdef CURLDEBUG |
| 302 |
bool test_event_based; |
| 303 |
#endif |
| 304 |
bool parallel; |
| 305 |
long parallel_max; |
| 306 |
bool parallel_connect; |
| 307 |
struct OperationConfig *first; |
| 308 |
struct OperationConfig *current; |
| 309 |
struct OperationConfig *last; /* Always last in the struct */ |
| 310 |
}; |
| 311 |
|
| 312 |
void config_init(struct OperationConfig *config); |
| 313 |
void config_free(struct OperationConfig *config); |
| 314 |
|
| 315 |
#endif /* HEADER_CURL_TOOL_CFGABLE_H */ |