Wget 1 is not preserving server-side modification times via FTP

Thomas Orgis <[email protected]> Wed, 29 May 2024 11:02:38 +0200
Newsgroups gmane.comp.web.wget.general
Message-ID <20240529110238.03d6c8b9@plasteblaster>
Hi all,

I noticed that while wget does nicely preserve Last-Modified times from
HTTP downloads, it does not do so for FTP, apparently. The example I see
is the upstream archive of the file tool:

	ftp://ftp.astron.com/pub/file/file-4.26.tar.gz

Wget correctly parses the time information:

$ wget -q -O- ftp://ftp.astron.com/pub/file/ | grep file-4.26
  2008 Aug 30        File        <a href="ftp://ftp.astron.com:21/pub/file/file-4.26.tar.gz">file-4.26.tar.gz</a>  (584803 bytes)

But on download, the file gets the current time as mtime:

$ wget -q ftp://ftp.astron.com/pub/file/file-4.26.tar.gz && LC_ALL=C ls -l file-4.26.tar.gz
-rw-r--r-- 1 thomas thomas 584803 May 29 08:32 file-4.26.tar.gz

I tried several versions of wget 1.x I could find/build. Wget-1.9.1
gets in an endless loop with this URL, wget-1.10.2 works, but also
already sets the wrong time. I wonder why I this comment

	https://bugzilla.mozilla.org/show_bug.cgi?id=178506#c7

in the wonderful bug discussion about Firefox' refusal to use server
mtimes claims that

	GNU's wget does this very nicely for ftp and http downloads.

Maybe wget 22 years ago had different FTP code. I'm not easily able to
run wget that old to try. So it may be a regression before 1.10.2, even
(which is already over 18 years ago!)

FTP support seems to be dropped altogether from Wget 2 (correct?).
There still are some FTP sites (like the rather prominent upstream of
file and libmagic above) and maybe this is another reason why I will
have to resort to curl for good, which does not preserve the time by
default, but offers --remote-time that works for both http and ftp
downloads.

Is a fix in wget 1.x something to be considered at this point in time?


Alrighty then,

Thomas
-- 
GPG public key 60D5CAFE: https://thomas.orgis.org/public_key
Fingerprint: D021 FF8E CF4B E097 19D6  1A27 231C 4CBC 60D5 CAFE
And despite all of you, I'm still doing it. Yes, I do write Perl code.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE0CH/js9L4JcZ1honIxxMvGDVyv4FAmZW7y4ACgkQIxxMvGDV
yv5egg//RfUtpphJXOmwPOr2nE4TnRZ5g8NziZ19vAjawmecL15j03cjL0S5wrIN
+6mcWXstWmpb7lAkPPs+A92zvux1HS9Yh3BxTaQdRS5op8q0O0e7rvWsZglIEnUx
GjnY+bVyK8NQp9PhyKgSIFkMllbSRNaktQtMcSTQdpoKGbK3yQVT9SJiJpsIqyhY
wOT7cVNrg9och93A/Ae59ZYzf30Q2RyrG3xz6m7HYSDXGTPknuhxVACCdYxbO46z
8R19HGVRLW4F0PvSShntCPe1OyhB30AHKNWzX799aTmVwec2tcY5OqcsU8Rg7jWh
jLq3vsuTy7EAsp8zThZeqsj4SCVjMNJNCqJNVX8cQz8aosyCKmT4gsyc3rvFl2om
YePa817PaAdKqSZy5I3Jcp0gvj40m3nvzxMplBXPBUevqlTye/B2CJGNrdYcwkvK
L8v27ci222zaqsTWafUnqD+SRq9gc07MWXQmrYr5D1pu6vKAhW8cXsHRS3ufVH3r
JGC/GXzCB3pVAcpzxN1Bgm5tEKTbpPwXyDs4WCUPIwHe0UYEYLQ6CTmt67R4CZgm
gPDBUFSssuy80YOYhU64E83WV9jpozabdWhB+x7X1S/6eoSalziV1eaJ33n4Lf/c
/51MizCDo1WeSWwaXFAHYEFSXrJF2NslzHY3jbrkV9u68t5HWIM=
=NLfA
-----END PGP SIGNATURE-----