From 43583130693fd7befaf182b9ef348716b17a185b Mon Sep 17 00:00:00 2001 From: micah Date: Wed, 29 Aug 2007 20:35:49 -0700 Subject: [PATCH] [svn] Fix #20322 - Use timestamp from most recent response. --- ChangeLog | 4 ++++ NEWS | 3 +++ src/ChangeLog | 11 +++++++++++ src/http.c | 16 +++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e8ba3963..2312d00f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,10 @@ * m4/wget.m4 (WGET_PROCESS_PO, AM_PATH_PROG_WITH_TEST): Add missing M4 quotation. Delete serial number. +2007-08-09 Micah Cowan + + * NEWS: Timestamping from most recent response. + 2007-08-08 Micah Cowan * NEWS: Call attention to the fact that Content-Disposition is diff --git a/NEWS b/NEWS index 41cc5c0e..64cb7965 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ Please send GNU Wget bug reports to . * Changes in Wget 1.11. +** Timestamping now uses the value from the most recent HTTP response, +rather than the first one it got. + ** configure.in now requires autoconf >= 2.61, rather than 2.59. ** Authentication information is no longer sent as part of the Referer diff --git a/src/ChangeLog b/src/ChangeLog index d727a40e..be8233ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -24,6 +24,11 @@ * spider.c (print_broken_links): Fixed incorrect plurals msgid usage, switched to use ngettext function. +2007-08-24 Micah Cowan + + * http.c (http_loop): Introduced time_came_from_head boolean + flag, to help avoid parsing the same Last-Modified header twice, + 2007-08-23 Joshua David Williams * spider.c (in_url_list_p): Removed the bool verbose argument @@ -39,6 +44,12 @@ * url.c (url_string): Use comparison, not assignment, in check for auth_mode == URL_AUTH_HIDE_PASSWD. +2007-08-09 Micah Cowan + + * http.c (http_loop): If we got a HEAD and then a GET, and the + GET had a timestamp, use that one, not any we may have gotten + from the HEAD. + 2007-08-08 Micah Cowan * init.c (defaults): Content disposition will not be default, diff --git a/src/http.c b/src/http.c index 26342593..414e8e69 100644 --- a/src/http.c +++ b/src/http.c @@ -2305,6 +2305,7 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer, { int count; bool got_head = false; /* used for time-stamping and filename detection */ + bool time_came_from_head = false; bool got_name = false; char *tms; const char *tmrate; @@ -2533,6 +2534,8 @@ Last-modified header missing -- time-stamps turned off.\n")); if (tmr == (time_t) (-1)) logputs (LOG_VERBOSE, _("\ Last-modified header invalid -- time-stamp ignored.\n")); + if (*dt & HEAD_ONLY) + time_came_from_head = true; } /* The time-stamping section. */ @@ -2637,7 +2640,18 @@ Remote file exists but recursion is disabled -- not retrieving.\n\n")); else fl = hstat.local_file; if (fl) - touch (fl, tmr); + { + time_t newtmr = -1; + /* Reparse time header, in case it's changed. */ + if (time_came_from_head + && hstat.remote_time && hstat.remote_time[0]) + { + newtmr = http_atotm (hstat.remote_time); + if (newtmr != -1) + tmr = newtmr; + } + touch (fl, tmr); + } } /* End of time-stamping section. */ -- 2.39.2