summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 581a33d..f9759c3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -275,6 +275,9 @@ static struct cmdline_option option_data[] =
{ IF_SSL ("certificate-type"), 0, OPT_VALUE, "certificatetype", -1 },
{ IF_SSL ("check-certificate"), 0, OPT_BOOLEAN, "checkcertificate", -1 },
{ "clobber", 0, OPT__CLOBBER, NULL, optional_argument },
+#ifdef HAVE_LIBZ
+ { "compression", 0, OPT_VALUE, "compression", -1 },
+#endif
{ "config", 0, OPT_VALUE, "chooseconfig", -1 },
{ "connect-timeout", 0, OPT_VALUE, "connecttimeout", -1 },
{ "continue", 'c', OPT_BOOLEAN, "continue", -1 },
@@ -359,6 +362,7 @@ static struct cmdline_option option_data[] =
#endif
{ "method", 0, OPT_VALUE, "method", -1 },
{ "mirror", 'm', OPT_BOOLEAN, "mirror", -1 },
+ { "netrc", 0, OPT_BOOLEAN, "netrc", -1 },
{ "no", 'n', OPT__NO, NULL, required_argument },
{ "no-clobber", 0, OPT_BOOLEAN, "noclobber", -1 },
{ "no-config", 0, OPT_BOOLEAN, "noconfig", -1},
@@ -424,7 +428,6 @@ static struct cmdline_option option_data[] =
{ "user", 0, OPT_VALUE, "user", -1 },
{ "user-agent", 'U', OPT_VALUE, "useragent", -1 },
{ "verbose", 'v', OPT_BOOLEAN, "verbose", -1 },
- { "verbose", 0, OPT_BOOLEAN, "verbose", -1 },
{ "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
{ "wait", 'w', OPT_VALUE, "wait", -1 },
{ "waitretry", 0, OPT_VALUE, "waitretry", -1 },
@@ -630,6 +633,8 @@ Download:\n"),
-nc, --no-clobber skip downloads that would download to\n\
existing files (overwriting them)\n"),
N_("\
+ --no-netrc don't try to obtain credentials from .netrc\n"),
+ N_("\
-c, --continue resume getting a partially-downloaded file\n"),
N_("\
--start-pos=OFFSET start downloading from zero-based position OFFSET\n"),
@@ -761,6 +766,10 @@ HTTP options:\n"),
--ignore-length ignore 'Content-Length' header field\n"),
N_("\
--header=STRING insert STRING among the headers\n"),
+#ifdef HAVE_LIBZ
+ N_("\
+ --compression=TYPE choose compression, one of auto, gzip and none\n"),
+#endif
N_("\
--max-redirect maximum redirections allowed per page\n"),
N_("\
@@ -809,7 +818,7 @@ HTTP options:\n"),
HTTPS (SSL/TLS) options:\n"),
N_("\
--secure-protocol=PR choose secure protocol, one of auto, SSLv2,\n\
- SSLv3, TLSv1 and PFS\n"),
+ SSLv3, TLSv1, TLSv1_1, TLSv1_2 and PFS\n"),
N_("\
--https-only only follow secure HTTPS links\n"),
N_("\
@@ -1382,10 +1391,10 @@ main (int argc, char **argv)
}
else if (strcmp (config_opt->long_name, "config") == 0)
{
- bool userrc_ret = true;
- userrc_ret &= run_wgetrc (optarg);
+ file_stats_t flstats;
use_userconfig = true;
- if (userrc_ret)
+ memset(&flstats, 0, sizeof(flstats));
+ if (file_exists_p(optarg, &flstats) && run_wgetrc (optarg, &flstats))
break;
else
{
@@ -1621,7 +1630,7 @@ WARNING: timestamping does nothing in combination with -O. See the manual\n\
for details.\n\n"));
opt.timestamping = false;
}
- if (opt.noclobber && file_exists_p(opt.output_document))
+ if (opt.noclobber && file_exists_p(opt.output_document, NULL))
{
/* Check if output file exists; if it does, exit. */
logprintf (LOG_VERBOSE,
@@ -1673,6 +1682,26 @@ for details.\n\n"));
}
}
+#ifdef HAVE_LIBZ
+ if (opt.always_rest || opt.start_pos >= 0)
+ {
+ if (opt.compression == compression_auto)
+ {
+ /* Compression does not work with --continue or --start-pos.
+ Since compression was not explicitly set, it will be disabled. */
+ opt.compression = compression_none;
+ }
+ else if (opt.compression != compression_none)
+ {
+ fprintf (stderr,
+ _("Compression does not work with --continue or"
+ " --start-pos, they will be disabled.\n"));
+ opt.always_rest = false;
+ opt.start_pos = -1;
+ }
+ }
+#endif
+
if (opt.ask_passwd && opt.passwd)
{
fprintf (stderr,
@@ -2082,7 +2111,7 @@ only if outputting to a regular file.\n"));
&dt, opt.recursive, iri, true);
}
- if (opt.delete_after && filename != NULL && file_exists_p (filename))
+ if (opt.delete_after && filename != NULL && file_exists_p (filename, NULL))
{
DEBUGP (("Removing file due to --delete-after in main():\n"));
logprintf (LOG_VERBOSE, _("Removing %s.\n"), filename);