tool_cfgable.h 13 KB

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