tool_cfgable.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 - 2019, 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. URLGlob *inglob;
  38. 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 *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. char *dns_servers; /* dot notation: 1.1.1.1;2.2.2.2 */
  89. char *dns_interface; /* interface name */
  90. char *dns_ipv4_addr; /* dot notation */
  91. char *dns_ipv6_addr; /* dot notation */
  92. char *userpwd;
  93. char *login_options;
  94. char *tls_username;
  95. char *tls_password;
  96. char *tls_authtype;
  97. char *proxy_tls_username;
  98. char *proxy_tls_password;
  99. char *proxy_tls_authtype;
  100. char *proxyuserpwd;
  101. char *proxy;
  102. int proxyver; /* set to CURLPROXY_HTTP* define */
  103. char *noproxy;
  104. char *mail_from;
  105. struct curl_slist *mail_rcpt;
  106. char *mail_auth;
  107. char *sasl_authzid; /* Authorisation identity (identity to use) */
  108. bool sasl_ir; /* Enable/disable SASL initial response */
  109. bool proxytunnel;
  110. bool ftp_append; /* APPE on ftp */
  111. bool use_ascii; /* select ascii or text transfer */
  112. bool autoreferer; /* automatically set referer */
  113. bool failonerror; /* fail on (HTTP) errors */
  114. bool show_headers; /* show headers to data output */
  115. bool no_body; /* don't get the body */
  116. bool dirlistonly; /* only get the FTP dir list */
  117. bool followlocation; /* follow http redirects */
  118. bool unrestricted_auth; /* Continue to send authentication (user+password)
  119. when following ocations, even when hostname
  120. changed */
  121. bool netrc_opt;
  122. bool netrc;
  123. char *netrc_file;
  124. struct getout *url_list; /* point to the first node */
  125. struct getout *url_last; /* point to the last/current node */
  126. struct getout *url_get; /* point to the node to fill in URL */
  127. struct getout *url_out; /* point to the node to fill in outfile */
  128. struct getout *url_ul; /* point to the node to fill in upload */
  129. char *doh_url;
  130. char *cipher_list;
  131. char *proxy_cipher_list;
  132. char *cipher13_list;
  133. char *proxy_cipher13_list;
  134. char *cert;
  135. char *proxy_cert;
  136. char *cert_type;
  137. char *proxy_cert_type;
  138. char *cacert;
  139. char *proxy_cacert;
  140. char *capath;
  141. char *proxy_capath;
  142. char *crlfile;
  143. char *proxy_crlfile;
  144. char *pinnedpubkey;
  145. char *proxy_pinnedpubkey;
  146. char *key;
  147. char *proxy_key;
  148. char *key_type;
  149. char *proxy_key_type;
  150. char *key_passwd;
  151. char *proxy_key_passwd;
  152. char *pubkey;
  153. char *hostpubmd5;
  154. char *engine;
  155. bool crlf;
  156. char *customrequest;
  157. char *krblevel;
  158. char *request_target;
  159. long httpversion;
  160. bool http09_allowed;
  161. bool nobuffer;
  162. bool readbusy; /* set when reading input returns EAGAIN */
  163. bool globoff;
  164. bool use_httpget;
  165. bool insecure_ok; /* set TRUE to allow insecure SSL connects */
  166. bool proxy_insecure_ok; /* set TRUE to allow insecure SSL connects
  167. for proxy */
  168. bool terminal_binary_ok;
  169. bool verifystatus;
  170. bool create_dirs;
  171. bool ftp_create_dirs;
  172. bool ftp_skip_ip;
  173. bool proxynegotiate;
  174. bool proxyntlm;
  175. bool proxydigest;
  176. bool proxybasic;
  177. bool proxyanyauth;
  178. char *writeout; /* %-styled format string to output */
  179. struct curl_slist *quote;
  180. struct curl_slist *postquote;
  181. struct curl_slist *prequote;
  182. long ssl_version;
  183. long ssl_version_max;
  184. long proxy_ssl_version;
  185. long ip_version;
  186. curl_TimeCond timecond;
  187. curl_off_t condtime;
  188. struct curl_slist *headers;
  189. struct curl_slist *proxyheaders;
  190. tool_mime *mimeroot;
  191. tool_mime *mimecurrent;
  192. curl_mime *mimepost;
  193. struct curl_slist *telnet_options;
  194. struct curl_slist *resolve;
  195. struct curl_slist *connect_to;
  196. HttpReq httpreq;
  197. /* for bandwidth limiting features: */
  198. curl_off_t sendpersecond; /* send to peer */
  199. curl_off_t recvpersecond; /* receive from peer */
  200. bool ftp_ssl;
  201. bool ftp_ssl_reqd;
  202. bool ftp_ssl_control;
  203. bool ftp_ssl_ccc;
  204. int ftp_ssl_ccc_mode;
  205. char *preproxy;
  206. int socks5_gssapi_nec; /* The NEC reference server does not protect the
  207. encryption type exchange */
  208. unsigned long socks5_auth;/* auth bitmask for socks5 proxies */
  209. char *proxy_service_name; /* set authentication service name for HTTP and
  210. SOCKS5 proxies */
  211. char *service_name; /* set authentication service name for DIGEST-MD5,
  212. Kerberos 5 and SPNEGO */
  213. bool tcp_nodelay;
  214. bool tcp_fastopen;
  215. long req_retry; /* number of retries */
  216. bool retry_connrefused; /* set connection refused as a transient error */
  217. long retry_delay; /* delay between retries (in seconds) */
  218. long retry_maxtime; /* maximum time to keep retrying */
  219. char *ftp_account; /* for ACCT */
  220. char *ftp_alternative_to_user; /* send command if USER/PASS fails */
  221. int ftp_filemethod;
  222. long tftp_blksize; /* TFTP BLKSIZE option */
  223. bool tftp_no_options; /* do not send TFTP options requests */
  224. bool ignorecl; /* --ignore-content-length */
  225. bool disable_sessionid;
  226. bool raw;
  227. bool post301;
  228. bool post302;
  229. bool post303;
  230. bool nokeepalive; /* for keepalive needs */
  231. long alivetime;
  232. bool content_disposition; /* use Content-disposition filename */
  233. int default_node_flags; /* default flags to search for each 'node', which
  234. is basically each given URL to transfer */
  235. bool xattr; /* store metadata in extended attributes */
  236. long gssapi_delegation;
  237. bool ssl_allow_beast; /* allow this SSL vulnerability */
  238. bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy*/
  239. bool ssl_no_revoke; /* disable SSL certificate revocation checks */
  240. /*bool proxy_ssl_no_revoke; */
  241. bool use_metalink; /* process given URLs as metalink XML file */
  242. metalinkfile *metalinkfile_list; /* point to the first node */
  243. metalinkfile *metalinkfile_last; /* point to the last/current node */
  244. char *oauth_bearer; /* OAuth 2.0 bearer token */
  245. bool nonpn; /* enable/disable TLS NPN extension */
  246. bool noalpn; /* enable/disable TLS ALPN extension */
  247. char *unix_socket_path; /* path to Unix domain socket */
  248. bool abstract_unix_socket; /* path to an abstract Unix domain socket */
  249. bool falsestart;
  250. bool path_as_is;
  251. double expect100timeout;
  252. bool suppress_connect_headers; /* suppress proxy CONNECT response headers
  253. from user callbacks */
  254. curl_error synthetic_error; /* if non-zero, it overrides any libcurl
  255. error */
  256. bool ssh_compression; /* enable/disable SSH compression */
  257. long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
  258. 0 is valid. default: CURL_HET_DEFAULT. */
  259. bool haproxy_protocol; /* whether to send HAProxy protocol v1 */
  260. bool disallow_username_in_url; /* disallow usernames in URLs */
  261. struct GlobalConfig *global;
  262. struct OperationConfig *prev;
  263. struct OperationConfig *next; /* Always last in the struct */
  264. struct State state; /* for create_transfer() */
  265. };
  266. struct GlobalConfig {
  267. int showerror; /* -1 == unset, default => show errors
  268. 0 => -s is used to NOT show errors
  269. 1 => -S has been used to show errors */
  270. bool mute; /* don't show messages, --silent given */
  271. bool noprogress; /* don't show progress bar --silent given */
  272. bool isatty; /* Updated internally if output is a tty */
  273. FILE *errors; /* Error stream, defaults to stderr */
  274. bool errors_fopened; /* Whether error stream isn't stderr */
  275. char *trace_dump; /* file to dump the network trace to */
  276. FILE *trace_stream;
  277. bool trace_fopened;
  278. trace tracetype;
  279. bool tracetime; /* include timestamp? */
  280. int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
  281. char *libcurl; /* Output libcurl code to this file name */
  282. bool fail_early; /* exit on first transfer error */
  283. bool styled_output; /* enable fancy output style detection */
  284. #ifdef CURLDEBUG
  285. bool test_event_based;
  286. #endif
  287. bool parallel;
  288. long parallel_max;
  289. struct OperationConfig *first;
  290. struct OperationConfig *current;
  291. struct OperationConfig *last; /* Always last in the struct */
  292. };
  293. void config_init(struct OperationConfig *config);
  294. void config_free(struct OperationConfig *config);
  295. #endif /* HEADER_CURL_TOOL_CFGABLE_H */