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