Format of date headers: `GMT` rather than `+0000`?

Format of date headers: `GMT` rather than `+0000`?

Format of date headers: `GMT` rather than `+0000`?

(1) By Stephen Weigand (weigand) on 2021-02-11 22:10:11 [link] [source]


Short version

I will be the first to admit I nothing about HTTP but I think line 620 of althttpd.c should have a capital %Z rather than lowercase %z:

613 /* Render seconds since 1970 as an RFC822 date string.  Return
614 ** a pointer to that string in a static buffer.
615 */
616 static char *Rfc822Date(time_t t){
617   struct tm *tm;
618   static char zDate[100];
619   tm = gmtime(&t);
620   strftime(zDate, sizeof(zDate), "%a, %d %b %Y %H:%M:%S %z", tm);
621   return zDate;                                        ^^^^
622 }


Long version

Via the Fossil documentation I learned about Althttpd and am running it for a hobby project. It's great and simple and I really like it.

I also have a work problem that involves downloading CSV files from a Web server that apparently doesn't provide a Last-Modified response HTTP header nor an Etag header which is unfortunate.

This work problem led me to a tool/site called REDbot ( which describes itself as:

... lint for HTTP resources; it tests protocol correctness, cacheability, content negotiation and more.

Per REDbot, the Althttp date headers are "not valid dates" and I think it's because the timezone is given as +0000 rather than GMT. Here is an example they flag from

HTTP/1.1 200 OK
Connection: keep-alive
Date: Thu, 11 Feb 2021 21:29:13 +0000           <--- These should be `GMT` 
Last-Modified: Sat, 06 Feb 2021 15:34:44 +0000  <--- rather than `+0000` (?)
Cache-Control: max-age=120
ETag: "m601eb714s1cc2"
Content-type: text/html; charset=utf-8
Content-length: 7362

Via web searching, I think the relevant standard is  Date/Time Formats

   Prior to 1995, there were three different formats commonly used by
   servers to communicate timestamps.  For compatibility with old
   implementations, all three are defined here.  The preferred format is
   a fixed-length and single-zone subset of the date and time
   specification used by the Internet Message Format [RFC5322].

     HTTP-date    = IMF-fixdate / obs-date

   An example of the preferred format is

     Sun, 06 Nov 1994 08:49:37 GMT    ; IMF-fixdate

   Examples of the two obsolete formats are

     Sunday, 06-Nov-94 08:49:37 GMT   ; obsolete RFC 850 format
     Sun Nov  6 08:49:37 1994         ; ANSI C's asctime() format

I don't mean to be annoying so I'm just sending this in case it's useful. It's certainly not a real problem for me.

Thank you and with much appreciation for Althttpd,


(2) By Stephen Weigand (weigand) on 2021-02-12 01:14:17 in reply to 1 [source]

And I see the change was made. :)

(3) By sodface on 2021-09-10 00:40:16 in reply to 2 [link] [source]

See also: