Skip to content
Snippets Groups Projects
Commit 6261cea0 authored by Timo Teräs's avatar Timo Teräs
Browse files

libfetch: allow obsolete date format in http timestamps

RFC2616 §3.3.1 requires compliant client to accept the two
obsolete formats in addition to the Internet standard format.

Based on patch by John Hallam <sw@j.hallam.dk>

(cherry picked from commit 908efa92)
parent 3ae196ec
No related branches found
No related tags found
No related merge requests found
Pipeline #295818 passed
...@@ -482,8 +482,15 @@ http_parse_mtime(const char *p, time_t *mtime) ...@@ -482,8 +482,15 @@ http_parse_mtime(const char *p, time_t *mtime)
locale = strdupa(setlocale(LC_TIME, NULL)); locale = strdupa(setlocale(LC_TIME, NULL));
setlocale(LC_TIME, "C"); setlocale(LC_TIME, "C");
/* RFC2616 §3.3.1 requires compliant client to accept the Internet
* standard, and the two obsolete, date formats:
* Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
* Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
* Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
*/
r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm); r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm);
/* XXX should add support for date-2 and date-3 */ if (!r) r = strptime(p, "%A, %d-%b-%y %H:%M:%S GMT", &tm);
if (!r) r = strptime(p, "%a %b %d %H:%M:%S %Y", &tm);
setlocale(LC_TIME, locale); setlocale(LC_TIME, locale);
if (r == NULL) if (r == NULL)
return (-1); return (-1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment