diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-02-12 17:26:54 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-02-12 17:26:54 +0100 |
| commit | 5f0cd92f0bdc74d1c087781dabc19b258bda0b2e (patch) | |
| tree | b279fe1f6eafc2d38c7e8b3c9015e896b141c521 | |
| parent | f6f7d6b05b66307aef549086f8dea24f530f49e8 (diff) | |
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
| -rw-r--r-- | http.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |
