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