| 1 |
/* struct options. |
| 2 |
Copyright (C) 1996-2011, 2015, 2018-2024 Free Software Foundation, |
| 3 |
Inc. |
| 4 |
|
| 5 |
This file is part of GNU Wget. |
| 6 |
|
| 7 |
GNU Wget is free software; you can redistribute it and/or modify |
| 8 |
it under the terms of the GNU General Public License as published by |
| 9 |
the Free Software Foundation; either version 3 of the License, or |
| 10 |
(at your option) any later version. |
| 11 |
|
| 12 |
GNU Wget is distributed in the hope that it will be useful, |
| 13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Wget. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
Additional permission under GNU GPL version 3 section 7 |
| 21 |
|
| 22 |
If you modify this program, or any covered work, by linking or |
| 23 |
combining it with the OpenSSL project's OpenSSL library (or a |
| 24 |
modified version of that library), containing parts covered by the |
| 25 |
terms of the OpenSSL or SSLeay licenses, the Free Software Foundation |
| 26 |
grants you additional permission to convey the resulting work. |
| 27 |
Corresponding Source for a non-source form of such a combination |
| 28 |
shall include the source code for the parts of OpenSSL used as well |
| 29 |
as that of the covered work. */ |
| 30 |
|
| 31 |
enum CHECK_CERT_MODES |
| 32 |
{ |
| 33 |
CHECK_CERT_OFF, |
| 34 |
CHECK_CERT_ON, |
| 35 |
CHECK_CERT_QUIET |
| 36 |
}; |
| 37 |
|
| 38 |
struct options |
| 39 |
{ |
| 40 |
int verbose; /* Are we verbose? (First set to -1, |
| 41 |
hence not boolean.) */ |
| 42 |
bool quiet; /* Are we quiet? */ |
| 43 |
int ntry; /* Number of tries per URL */ |
| 44 |
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */ |
| 45 |
bool retry_on_host_error; /* Treat host errors as non-fatal. */ |
| 46 |
char *retry_on_http_error; /* Treat given HTTP errors as non-fatal. */ |
| 47 |
bool background; /* Whether we should work in background. */ |
| 48 |
bool ignore_length; /* Do we heed content-length at all? */ |
| 49 |
bool recursive; /* Are we recursive? */ |
| 50 |
bool spanhost; /* Do we span across hosts in |
| 51 |
recursion? */ |
| 52 |
int max_redirect; /* Maximum number of times we'll allow |
| 53 |
a page to redirect. */ |
| 54 |
bool relative_only; /* Follow only relative links. */ |
| 55 |
bool no_parent; /* Restrict access to the parent |
| 56 |
directory. */ |
| 57 |
int reclevel; /* Maximum level of recursion */ |
| 58 |
bool dirstruct; /* Do we build the directory structure |
| 59 |
as we go along? */ |
| 60 |
bool no_dirstruct; /* Do we hate dirstruct? */ |
| 61 |
int cut_dirs; /* Number of directory components to cut. */ |
| 62 |
bool add_hostdir; /* Do we add hostname directory? */ |
| 63 |
bool protocol_directories; /* Whether to prepend "http"/"ftp" to dirs. */ |
| 64 |
bool noclobber; /* Disables clobbering of existing data. */ |
| 65 |
bool unlink_requested; /* remove file before clobbering */ |
| 66 |
char *dir_prefix; /* The top of directory tree */ |
| 67 |
char *lfilename; /* Log filename */ |
| 68 |
char *input_filename; /* Input filename */ |
| 69 |
#ifdef HAVE_METALINK |
| 70 |
char *input_metalink; /* Input metalink file */ |
| 71 |
int metalink_index; /* Metalink application/metalink4+xml metaurl ordinal number. */ |
| 72 |
bool metalink_over_http; /* Use Metalink if present in HTTP response */ |
| 73 |
char *preferred_location; /* Preferred location for Metalink resources */ |
| 74 |
#endif |
| 75 |
char *choose_config; /* Specified config file */ |
| 76 |
bool noconfig; /* Ignore all config files? */ |
| 77 |
bool force_html; /* Is the input file an HTML file? */ |
| 78 |
|
| 79 |
char *default_page; /* Alternative default page (index file) */ |
| 80 |
|
| 81 |
bool spider; /* Is Wget in spider mode? */ |
| 82 |
|
| 83 |
char **accepts; /* List of patterns to accept. */ |
| 84 |
char **rejects; /* List of patterns to reject. */ |
| 85 |
const char **excludes; /* List of excluded FTP directories. */ |
| 86 |
const char **includes; /* List of FTP directories to |
| 87 |
follow. */ |
| 88 |
bool ignore_case; /* Whether to ignore case when |
| 89 |
matching dirs and files */ |
| 90 |
|
| 91 |
char *acceptregex_s; /* Patterns to accept (a regex string). */ |
| 92 |
char *rejectregex_s; /* Patterns to reject (a regex string). */ |
| 93 |
void *acceptregex; /* Patterns to accept (a regex struct). */ |
| 94 |
void *rejectregex; /* Patterns to reject (a regex struct). */ |
| 95 |
enum { |
| 96 |
#if defined HAVE_LIBPCRE || HAVE_LIBPCRE2 |
| 97 |
regex_type_pcre, |
| 98 |
#endif |
| 99 |
regex_type_posix |
| 100 |
} regex_type; /* The regex library. */ |
| 101 |
void *(*regex_compile_fun)(const char *); /* Function to compile a regex. */ |
| 102 |
bool (*regex_match_fun)(const void *, const char *); /* Function to match a string to a regex. */ |
| 103 |
|
| 104 |
#ifdef HAVE_LIBCARES |
| 105 |
char *bind_dns_address; |
| 106 |
char *dns_servers; |
| 107 |
#endif |
| 108 |
|
| 109 |
char **domains; /* See host.c */ |
| 110 |
char **exclude_domains; |
| 111 |
bool dns_cache; /* whether we cache DNS lookups. */ |
| 112 |
|
| 113 |
char **follow_tags; /* List of HTML tags to recursively follow. */ |
| 114 |
char **ignore_tags; /* List of HTML tags to ignore if recursing. */ |
| 115 |
|
| 116 |
bool follow_ftp; /* Are FTP URL-s followed in recursive |
| 117 |
retrieving? */ |
| 118 |
bool retr_symlinks; /* Whether we retrieve symlinks in |
| 119 |
FTP. */ |
| 120 |
char *output_document; /* The output file to which the |
| 121 |
documents will be printed. */ |
| 122 |
char *warc_filename; /* WARC output filename */ |
| 123 |
char *warc_tempdir; /* WARC temp dir */ |
| 124 |
char *warc_cdx_dedup_filename;/* CDX file to be used for deduplication. */ |
| 125 |
wgint warc_maxsize; /* WARC max archive size */ |
| 126 |
bool warc_compression_enabled;/* For GZIP compression. */ |
| 127 |
bool warc_digests_enabled; /* For SHA1 digests. */ |
| 128 |
bool warc_cdx_enabled; /* Create CDX files? */ |
| 129 |
bool warc_keep_log; /* Store the log file in a WARC record. */ |
| 130 |
char **warc_user_headers; /* User-defined WARC header(s). */ |
| 131 |
|
| 132 |
bool enable_xattr; /* Store metadata in POSIX extended attributes. */ |
| 133 |
|
| 134 |
char *user; /* Generic username */ |
| 135 |
char *passwd; /* Generic password */ |
| 136 |
bool ask_passwd; /* Ask for password? */ |
| 137 |
char *use_askpass; /* value to use for use-askpass if WGET_ASKPASS is not set */ |
| 138 |
|
| 139 |
bool always_rest; /* Always use REST. */ |
| 140 |
wgint start_pos; /* Start position of a download. */ |
| 141 |
char *ftp_user; /* FTP username */ |
| 142 |
char *ftp_passwd; /* FTP password */ |
| 143 |
bool netrc; /* Whether to read .netrc. */ |
| 144 |
bool ftp_glob; /* FTP globbing */ |
| 145 |
bool ftp_pasv; /* Passive FTP. */ |
| 146 |
|
| 147 |
char *http_user; /* HTTP username. */ |
| 148 |
char *http_passwd; /* HTTP password. */ |
| 149 |
char **user_headers; /* User-defined header(s). */ |
| 150 |
bool http_keep_alive; /* whether we use keep-alive */ |
| 151 |
|
| 152 |
bool use_proxy; /* Do we use proxy? */ |
| 153 |
bool allow_cache; /* Do we allow server-side caching? */ |
| 154 |
char *http_proxy, *ftp_proxy, *https_proxy; |
| 155 |
char **no_proxy; |
| 156 |
char *base_href; |
| 157 |
char *progress_type; /* progress indicator type. */ |
| 158 |
int show_progress; /* Show only the progress bar */ |
| 159 |
bool noscroll; /* Don't scroll the filename in the progressbar */ |
| 160 |
char *proxy_user; /*oli*/ |
| 161 |
char *proxy_passwd; |
| 162 |
|
| 163 |
double read_timeout; /* The read/write timeout. */ |
| 164 |
double dns_timeout; /* The DNS timeout. */ |
| 165 |
double connect_timeout; /* The connect timeout. */ |
| 166 |
|
| 167 |
bool random_wait; /* vary from 0 .. wait secs by random()? */ |
| 168 |
double wait; /* The wait period between retrievals. */ |
| 169 |
double waitretry; /* The wait period between retries. - HEH */ |
| 170 |
bool use_robots; /* Do we heed robots.txt? */ |
| 171 |
|
| 172 |
wgint limit_rate; /* Limit the download rate to this |
| 173 |
many bps. */ |
| 174 |
wgint quota; /* Maximum file size to download and |
| 175 |
store. */ |
| 176 |
|
| 177 |
bool server_response; /* Do we print server response? */ |
| 178 |
bool save_headers; /* Do we save headers together with |
| 179 |
file? */ |
| 180 |
bool content_on_error; /* Do we output the content when the HTTP |
| 181 |
status code indicates a server error */ |
| 182 |
|
| 183 |
bool debug; /* Debugging on/off */ |
| 184 |
|
| 185 |
#ifdef USE_WATT32 |
| 186 |
bool wdebug; /* Watt-32 tcp/ip debugging on/off */ |
| 187 |
#endif |
| 188 |
|
| 189 |
bool timestamping; /* Whether to use time-stamping. */ |
| 190 |
bool if_modified_since; /* Whether to use conditional get requests. */ |
| 191 |
|
| 192 |
bool backup_converted; /* Do we save pre-converted files as *.orig? */ |
| 193 |
int backups; /* Are numeric backups made? */ |
| 194 |
|
| 195 |
char *useragent; /* User-Agent string, which can be set |
| 196 |
to something other than Wget. */ |
| 197 |
char *referer; /* Naughty Referer, which can be |
| 198 |
set to something other than |
| 199 |
NULL. */ |
| 200 |
bool convert_links; /* Will the links be converted |
| 201 |
locally? */ |
| 202 |
bool convert_file_only; /* Convert only the file portion of the URI (i.e. basename). |
| 203 |
Leave everything else untouched. */ |
| 204 |
|
| 205 |
bool remove_listing; /* Do we remove .listing files |
| 206 |
generated by FTP? */ |
| 207 |
bool htmlify; /* Do we HTML-ify the OS-dependent |
| 208 |
listings? */ |
| 209 |
|
| 210 |
char *dot_style; |
| 211 |
wgint dot_bytes; /* How many bytes in a printing |
| 212 |
dot. */ |
| 213 |
int dots_in_line; /* How many dots in one line. */ |
| 214 |
int dot_spacing; /* How many dots between spacings. */ |
| 215 |
|
| 216 |
bool delete_after; /* Whether the files will be deleted |
| 217 |
after download. */ |
| 218 |
|
| 219 |
bool adjust_extension; /* Use ".html" extension on all text/html? */ |
| 220 |
|
| 221 |
bool page_requisites; /* Whether we need to download all files |
| 222 |
necessary to display a page properly. */ |
| 223 |
char *bind_address; /* What local IP address to bind to. */ |
| 224 |
|
| 225 |
#ifdef HAVE_SSL |
| 226 |
enum { |
| 227 |
secure_protocol_auto, |
| 228 |
secure_protocol_sslv2, |
| 229 |
secure_protocol_sslv3, |
| 230 |
secure_protocol_tlsv1, |
| 231 |
secure_protocol_tlsv1_1, |
| 232 |
secure_protocol_tlsv1_2, |
| 233 |
secure_protocol_tlsv1_3, |
| 234 |
secure_protocol_pfs |
| 235 |
} secure_protocol; /* type of secure protocol to use. */ |
| 236 |
char secure_protocol_name[8]; /* name of secure protocol to use. */ |
| 237 |
int check_cert; /* whether to validate the server's cert */ |
| 238 |
char *cert_file; /* external client certificate to use. */ |
| 239 |
char *private_key; /* private key file (if not internal). */ |
| 240 |
enum keyfile_type { |
| 241 |
keyfile_pem, |
| 242 |
keyfile_asn1 |
| 243 |
} cert_type; /* type of client certificate file */ |
| 244 |
enum keyfile_type |
| 245 |
private_key_type; /* type of private key file */ |
| 246 |
|
| 247 |
char *ca_directory; /* CA directory (hash files) */ |
| 248 |
char *ca_cert; /* CA certificate file to use */ |
| 249 |
char *crl_file; /* file with CRLs */ |
| 250 |
|
| 251 |
char *pinnedpubkey; /* Public key (PEM/DER) file, or any number |
| 252 |
of base64 encoded sha256 hashes preceded by |
| 253 |
\'sha256//\' and separated by \';\', to verify |
| 254 |
peer against */ |
| 255 |
|
| 256 |
char *random_file; /* file with random data to seed the PRNG */ |
| 257 |
char *egd_file; /* file name of the egd daemon socket */ |
| 258 |
bool https_only; /* whether to follow HTTPS only */ |
| 259 |
bool ftps_resume_ssl; |
| 260 |
bool ftps_fallback_to_ftp; |
| 261 |
bool ftps_implicit; |
| 262 |
bool ftps_clear_data_connection; |
| 263 |
|
| 264 |
char *tls_ciphers_string; |
| 265 |
#endif /* HAVE_SSL */ |
| 266 |
|
| 267 |
bool cookies; /* whether cookies are used. */ |
| 268 |
char *cookies_input; /* file we're loading the cookies from. */ |
| 269 |
char *cookies_output; /* file we're saving the cookies to. */ |
| 270 |
bool keep_badhash; /* Keep files with checksum mismatch. */ |
| 271 |
bool keep_session_cookies; /* whether session cookies should be |
| 272 |
saved and loaded. */ |
| 273 |
|
| 274 |
char *post_data; /* POST query string */ |
| 275 |
char *post_file_name; /* File to post */ |
| 276 |
char *method; /* HTTP Method to use in Header */ |
| 277 |
char *body_data; /* HTTP Method Data String */ |
| 278 |
char *body_file; /* HTTP Method File */ |
| 279 |
|
| 280 |
enum { |
| 281 |
restrict_unix, |
| 282 |
restrict_vms, |
| 283 |
restrict_windows |
| 284 |
} restrict_files_os; /* file name restriction ruleset. */ |
| 285 |
bool restrict_files_ctrl; /* non-zero if control chars in URLs |
| 286 |
are restricted from appearing in |
| 287 |
generated file names. */ |
| 288 |
bool restrict_files_nonascii; /* non-zero if bytes with values greater |
| 289 |
than 127 are restricted. */ |
| 290 |
enum { |
| 291 |
restrict_no_case_restriction, |
| 292 |
restrict_lowercase, |
| 293 |
restrict_uppercase |
| 294 |
} restrict_files_case; /* file name case restriction. */ |
| 295 |
|
| 296 |
bool strict_comments; /* whether strict SGML comments are |
| 297 |
enforced. */ |
| 298 |
|
| 299 |
bool preserve_perm; /* whether remote permissions are used |
| 300 |
or that what is set by umask. */ |
| 301 |
|
| 302 |
#ifdef ENABLE_IPV6 |
| 303 |
bool ipv4_only; /* IPv4 connections have been requested. */ |
| 304 |
bool ipv6_only; /* IPv4 connections have been requested. */ |
| 305 |
#endif |
| 306 |
enum { |
| 307 |
prefer_ipv4, |
| 308 |
prefer_ipv6, |
| 309 |
prefer_none |
| 310 |
} prefer_family; /* preferred address family when more |
| 311 |
than one type is available */ |
| 312 |
|
| 313 |
bool content_disposition; /* Honor HTTP Content-Disposition header. */ |
| 314 |
bool auth_without_challenge; /* Issue Basic authentication creds without |
| 315 |
waiting for a challenge. */ |
| 316 |
|
| 317 |
bool enable_iri; |
| 318 |
char *encoding_remote; |
| 319 |
const char *locale; |
| 320 |
|
| 321 |
bool trustservernames; |
| 322 |
#ifdef __VMS |
| 323 |
int ftp_stmlf; /* Force Stream_LF format for binary FTP. */ |
| 324 |
#endif /* def __VMS */ |
| 325 |
|
| 326 |
bool useservertimestamps; /* Update downloaded files' timestamps to |
| 327 |
match those on server? */ |
| 328 |
|
| 329 |
bool show_all_dns_entries; /* Show all the DNS entries when resolving a |
| 330 |
name. */ |
| 331 |
bool report_bps; /*Output bandwidth in bits format*/ |
| 332 |
|
| 333 |
#ifdef HAVE_LIBZ |
| 334 |
enum compression_options { |
| 335 |
compression_auto, |
| 336 |
compression_gzip, |
| 337 |
compression_none |
| 338 |
} compression; /* type of HTTP compression to use */ |
| 339 |
#endif |
| 340 |
|
| 341 |
char *rejected_log; /* The file to log rejected URLS to. */ |
| 342 |
|
| 343 |
#ifdef HAVE_HSTS |
| 344 |
bool hsts; |
| 345 |
char *hsts_file; |
| 346 |
#endif |
| 347 |
|
| 348 |
const char *homedir; /* the homedir of the running process */ |
| 349 |
const char *wgetrcfile; /* the wgetrc file to be loaded */ |
| 350 |
}; |
| 351 |
|
| 352 |
extern struct options opt; |