Althttpd

View Ticket
Login
Ticket Hash: e5a308564b4af73908110576efe5ef877ab5bc03
Title: Header date format Invalid on musl libc systems
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2022-02-18 14:44:30
Version Found In: 202108141729
User Comments:
sodface added on 2021-09-24 02:13:41:

Alpine Linux uses musl libc vice glibc. This commit to musl libc results in strftime %Z returning "UTC" in the althttpd.c function Rfc822Date when althttpd is running on Alpine Linux and presumably any other musl libc based distro.

"UTC" in date headers instead of "GMT" causes issues with some applications such as GNU wget and Alpine's package manager (apk) which uses libfetch. In the latter case, the application fails altogether.

RFC 7231 specifies "GMT" not "UTC".

This page on strftime says:

If a struct tm broken-down time structure is created or modified by gmtime() or gmtime_r(), it is unspecified whether the result of the %Z and %z conversion specifiers shall refer to UTC or the current local timezone, when strftime() is called with such a broken-down time structure.

I'm filing this bug report here as I believe the use of the %Z specifier in this context within althttpd.c is the issue and not musl libc's decision to return UTC vice GMT.

See also this forum post.


stephan added on 2022-02-18 14:44:30:

Fixed in c9214e8e4831c4ae.