From 5f0cd92f0bdc74d1c087781dabc19b258bda0b2e Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 12 Feb 2026 17:26:54 +0100 Subject: http.c: Use expected timezone abbreviation The struct tm instance consumed by append_expire is provided by users and could refer to any timezone, rather than GMT only. According to Wikipedia [1], timezone abbreviations are either 3 or 4 characters long, or use numeric UTC offsets. [1]: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#Time_zone_abbreviations --- http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 978eea6..d87a5e5 100644 --- a/http.c +++ b/http.c @@ -2753,7 +2753,7 @@ failure: static int append_expire(struct dynstr *const d, const struct tm *const exp) { int ret = -1; - char s[sizeof "Thu, 01 Jan 1970 00:00:00 GMT"]; + char s[sizeof "Thu, 01 Jan 1970 00:00:00 XXXX"]; const locale_t l = newlocale(LC_TIME_MASK, "POSIX", (locale_t)0); if (l == (locale_t)0) @@ -2761,7 +2761,7 @@ static int append_expire(struct dynstr *const d, const struct tm *const exp) fprintf(stderr, "%s: newlocale(3): %s\n", __func__, strerror(errno)); goto end; } - else if (!strftime_l(s, sizeof s, "%a, %d %b %Y %H:%M:%S GMT", exp, l)) + else if (!strftime_l(s, sizeof s, "%a, %d %b %Y %H:%M:%S %Z", exp, l)) { fprintf(stderr, "%s: strftime_l(3) failed\n", __func__); return -1; -- cgit v1.2.3