From 0b45b6e5de1ba4224ced67a9952e009d0f4139a0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 2 Jul 2016 11:28:42 +0200 Subject: use +0000 instead of UTC by default as timezone in output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All apt versions support numeric as well as 3-character timezones just fine and its actually hard to write code which doesn't "accidently" accepts it. So why change? Documenting the Date/Valid-Until fields in the Release file is easy to do in terms of referencing the datetime format used e.g. in the Debian changelogs (policy ยง4.4). This format specifies only the numeric timezones through, not the nowadays obsolete 3-character ones, so in the interest of least surprise we should use the same format even through it carries a small risk of regression in other clients (which encounter repositories created with apt-ftparchive). In case it is really regressing in practice, the hidden option -o APT::FTPArchive::Release::NumericTimezone=0 can be used to go back to good old UTC as timezone. The EDSP and EIPP protocols use this 'new' format, the text interface used to communicate with the acquire methods does not for compatibility reasons even if none of our methods would be effected and I doubt any other would (in these instances the timezone is 'GMT' as that is what HTTP/1.1 requires). Note that this is only true for apt talking to methods, (libapt-based) methods talking to apt will respond with the 'new' format. It is therefore strongly adviced to support both also in method input. --- test/integration/framework | 10 +++++----- test/interactive-helper/aptwebserver.cc | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/integration/framework b/test/integration/framework index 8ca878148..4aa89cf20 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -219,10 +219,10 @@ gdb() { runapt command gdb --quiet -ex run "$CMD" --args "$CMD" "$@" } lastmodification() { - date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" '+%a, %d %b %Y %H:%M:%S GMT' + date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R } releasefiledate() { - grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- | sed -e 's#UTC#GMT#' + grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- } exitwithstatus() { @@ -1016,13 +1016,13 @@ NotAutomatic: yes' "$dir/Release" fi if [ -n "$DATE" -a "$DATE" != "now" ]; then for release in $(find ./aptarchive -name 'Release'); do - sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" '+%a, %d %b %Y %H:%M:%S %Z')/" "$release" + sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" touch -d "$DATE" "$release" done fi if [ -n "$VALIDUNTIL" ]; then sed -i "/^Date: / a\ -Valid-Until: $(date -u -d "$VALIDUNTIL" '+%a, %d %b %Y %H:%M:%S %Z')" $(find ./aptarchive -name 'Release') +Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') fi msgdone "info" } @@ -1154,7 +1154,7 @@ signreleasefiles() { } redatereleasefiles() { - local DATE="$(date -u -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')" + local DATE="$(date -u -d "$1" -R)" for release in $(find aptarchive/ -name 'Release'); do sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" touch -d "$DATE" "$release" diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 3e91406ab..817760ec3 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -99,7 +99,7 @@ static void addFileHeaders(std::list &headers, FileFd &data)/*{{{*/ if (_config->FindB("aptwebserver::support::last-modified", true) == true) { std::string lastmodified("Last-Modified: "); - lastmodified.append(TimeRFC1123(data.ModificationTime())); + lastmodified.append(TimeRFC1123(data.ModificationTime(), false)); headers.push_back(lastmodified); } } @@ -128,7 +128,7 @@ static bool sendHead(int const client, int const httpcode, std::listd_name << "\">" << namelist[i]->d_name << "" << "" << SizeToStr(fs.st_size) << "B"; } - listing << "" << TimeRFC1123(fs.st_mtime) << "" << std::endl; + listing << "" << TimeRFC1123(fs.st_mtime, true) << "" << std::endl; } listing << "" << std::endl; -- cgit v1.2.3-70-g09d2