tool_cfgable.h 12 KB

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