Thursday, April 02, 2026

Re: ftp and Last-Modified:

On Thu, Apr 02, 2026 at 11:23:01AM +0200, Rene Kita wrote:
> I see some strange behaviour when trying to use ftp -T to conditionally
> download a file if it has changed. This is ftp from 7.8.
[...]
> What am I doing wrong here?

Nothing. This works in -current:

$ ftp -V https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Modified-Since
If-Modified-Since
100% |*************************************************| 201 KB 00:00
$ ftp -T https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Modified-Since
Trying 151.101.65.91...
Requesting https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Modified-Since
ftp: File is not modified on the server

In the 7.8 cycle there was a change to localtime.c that made gmtime(3)
emit "UTC" instead of "GMT":

https://github.com/openbsd/src/commit/4282d69da8896f476db477e0b83a24fb8d13f177

ftp uses gmtime + strftime to format If-Modified-Since via http_time()
and thus started using a time format that isn't conformant to RFC 9110.
This was fixed via this commit:

https://github.com/openbsd/src/commit/a13a1de1a844c69139cfb0641d99fd5643aa6588

prompted by a similar diff for httpd by Sören Tempel:

https://github.com/openbsd/src/commit/668f1f05e71c5e979d278f1ad4568956226715ea

No comments:

Post a Comment