From d9e4b853a13ea7d051bca5ac8e5ef0d066e4acaf Mon Sep 17 00:00:00 2001 From: Hubert Tarasiuk Date: Tue, 5 May 2015 19:33:02 +0200 Subject: [PATCH 4/6] Add --if-modified-since option * src/init.c: Add to commands array. * src/main.c: Add to cmdline_option. Add to help message. * src/options.h: Add to options struct. --- src/init.c | 2 ++ src/main.c | 4 ++++ src/options.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/init.c b/src/init.c index 33888de..a436ef2 100644 --- a/src/init.c +++ b/src/init.c @@ -205,6 +205,7 @@ static const struct { #endif { "httpsproxy", &opt.https_proxy, cmd_string }, { "httpuser", &opt.http_user, cmd_string }, + { "if-modified-since", &opt.if_modified_since, cmd_boolean }, { "ignorecase", &opt.ignore_case, cmd_boolean }, { "ignorelength", &opt.ignore_length, cmd_boolean }, { "ignoretags", &opt.ignore_tags, cmd_vector }, @@ -361,6 +362,7 @@ defaults (void) opt.no_proxy = sepstring (tmp); opt.prefer_family = prefer_none; opt.allow_cache = true; + opt.if_modified_since = true; opt.read_timeout = 900; opt.use_robots = true; diff --git a/src/main.c b/src/main.c index b59fcab..a0044d9 100644 --- a/src/main.c +++ b/src/main.c @@ -301,6 +301,7 @@ static struct cmdline_option option_data[] = { "strict-comments", 0, OPT_BOOLEAN, "strictcomments", -1 }, { "timeout", 'T', OPT_VALUE, "timeout", -1 }, { "timestamping", 'N', OPT_BOOLEAN, "timestamping", -1 }, + { "if-modified-since", 0, OPT_BOOLEAN, "if-modified-since", -1 }, { "tries", 't', OPT_VALUE, "tries", -1 }, { "unlink", 0, OPT_BOOLEAN, "unlink", -1 }, { "trust-server-names", 0, OPT_BOOLEAN, "trustservernames", -1 }, @@ -516,6 +517,9 @@ Download:\n"), -N, --timestamping don't re-retrieve files unless newer than\n\ local\n"), N_("\ + --no-if-modified-since don't use conditional if-modified-since get\n\ + requests in timestamping mode\n"), + N_("\ --no-use-server-timestamps don't set the local file's timestamp by\n\ the one on the server\n"), N_("\ diff --git a/src/options.h b/src/options.h index bded0c4..bef1f10 100644 --- a/src/options.h +++ b/src/options.h @@ -165,6 +165,7 @@ struct options #endif bool timestamping; /* Whether to use time-stamping. */ + bool if_modified_since; /* Whether to use conditional get requests. */ bool backup_converted; /* Do we save pre-converted files as *.orig? */ int backups; /* Are numeric backups made? */ -- 2.4.1