cURL / Mailing Lists / curl-library / Single Mail


Re: [ curl-Patches-831843 ] Add --head support for file: protocol

From: David Hull <>
Date: Thu, 30 Oct 2003 19:19:55 -0800

Daniel Stenberg wrote:
> I realize this code was copied from lib/ftp.c and the problem might
> exist there too, but in the case of FTP the time zone given by the
> server is not known!

According to some (non-definitive) information I found through google,
the ftp MDTM command returns the time in UTC (and this is true of our
ftp server).

I wrote:
> The call to localtime/localtime_r should be to gmtime/gmtime_r.
> The same change needs to be made in ftp.c.

I'm wrong, ftp.c is OK for "--head".

The ftp_getfiletime gets the files modification time using MDTM, but
calls curl_getdate without specifying a time zone, so apparently the
local time zone is assumed. Then, in ftp_perform, localtime is used
to convert into a struct tm, but the strftime format string specifies
"GMT". The two "mistakes" cancel out.

It seems to me like both ftp_getfiletime and ftp_perform should be
changed to use UTC. However, I'm not sure if this would break the

David Hull
This email is sponsored by: Giveback Program.
Does help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here:
Received on 2003-10-31