tool_cfgable.h 13 KB

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