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