Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: httpd: Invalid date formats in headers since 7.8
To:
Sören Tempel <soeren@soeren-tempel.net>, tech@openbsd.org, phessler@openbsd.org
Date:
Sun, 21 Dec 2025 00:19:09 +0100

Download raw body.

Thread
On Sat, Dec 20, 2025 at 10:52:17PM +0000, Stuart Henderson wrote:
> On 2025/12/20 22:36, Sören Tempel wrote:
> > Hi!
> > 
> > Starting with OpenBSD 7.8, httpd(8) uses a date format for headers
> > (e.g., Last-Modified) that is incompatible with RFC 7231. The RFC 7231
> > ABNF grammar rule for IMF-fixdate, which is supposed to be emitted by
> > httpd's server_http_time() function looks as follows [1]:
> 
> Also still the case with the current standard
> 
> https://datatracker.ietf.org/doc/html/rfc9110#http.date
> 
> > 	IMF-fixdate = day-name "," SP date1 SP time-of-day SP GMT

Committed, thanks. ftp wants a corresponding change for If-Modified-Since:
(I think we can leave the strptime in fetch.c as-is)

Index: util.c
===================================================================
RCS file: /cvs/src/usr.bin/ftp/util.c,v
diff -u -p -U4 -r1.98 util.c
--- util.c	8 Mar 2023 04:43:11 -0000	1.98
+++ util.c	20 Dec 2025 23:16:00 -0000
@@ -1161,7 +1161,7 @@ http_time(time_t t, char *tmbuf, size_t 
 	/* New HTTP/1.1 RFC 7231 prefers IMF-fixdate from RFC 5322 */
 	if (gmtime_r(&t, &tm) == NULL)
 		return 0;
 	else
-		return (strftime(tmbuf, len, "%a, %d %h %Y %T %Z", &tm));
+		return (strftime(tmbuf, len, "%a, %d %h %Y %T GMT", &tm));
 }
 #endif /* !SMALL */