From e153dc540f518fc575460e87253ce453157685ad Mon Sep 17 00:00:00 2001 From: bdrewery Date: Wed, 19 Mar 2014 00:54:43 +0000 Subject: [PATCH] MFC r263021: Support Last-Modified behind proxies which return UTC instead of GMT. git-svn-id: svn://svn.freebsd.org/base/stable/9@263326 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- lib/libfetch/http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 87535f001..c7c4889f0 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -878,6 +878,12 @@ http_parse_mtime(const char *p, time_t *mtime) strncpy(locale, setlocale(LC_TIME, NULL), sizeof(locale)); setlocale(LC_TIME, "C"); r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm); + /* + * Some proxies use UTC in response, but it should still be + * parsed. RFC2616 states GMT and UTC are exactly equal for HTTP. + */ + if (r == NULL) + r = strptime(p, "%a, %d %b %Y %H:%M:%S UTC", &tm); /* XXX should add support for date-2 and date-3 */ setlocale(LC_TIME, locale); if (r == NULL) -- 2.45.0