Re: mirror not setting timestamps correctly

"Alexander V. Lukyanov" <[email protected]> Mon, 24 Jul 2006 18:16:49 +0400
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
On Mon, Jul 24, 2006 at 08:36:34AM -0500, Albert Chin wrote:
> We have a bug report from one of our customers. It seems lftp with the
> mirror command does not set the timestamps of local files to match
> those of the remote files. Both 3.3.4 and 3.5.1 seem to have this bug:
>   These conditions must be:
>
>   - the lftp client is configured to use an HTTP proxy (FTP over HTTP
>     protocol), the configuration setup in ~/.lftp/rc:

Here is a patch which fixes two bugs, wrong month and using imprecise time.
Please test.

--
   Alexander.                      | http://www.yars.free.net/~lav/
diff (text/plain, 1.1 KB)
Index: HttpDir.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/HttpDir.cc,v
retrieving revision 1.94
diff -u -p -r1.94 HttpDir.cc
--- HttpDir.cc	13 Jun 2006 14:35:37 -0000	1.94
+++ HttpDir.cc	24 Jul 2006 14:11:58 -0000
@@ -1072,7 +1072,7 @@ parse_url_again:
 	 struct tm tm;
 	 memset(&tm,0,sizeof(tm));
 	 tm.tm_year=info.year-1900;
-	 tm.tm_mon=info.month-1;
+	 tm.tm_mon=info.month;
 	 tm.tm_mday=info.day;
 	 tm.tm_hour=12;
 	 info.date_prec=43200;
Index: MirrorJob.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/MirrorJob.cc,v
retrieving revision 1.135
diff -u -p -r1.135 MirrorJob.cc
--- MirrorJob.cc	24 Jul 2006 08:50:19 -0000	1.135
+++ MirrorJob.cc	24 Jul 2006 14:12:35 -0000
@@ -297,7 +297,7 @@ void  MirrorJob::HandleFile(FileInfo *fi
 	       c->RemoveTargetFirst();
 	    CopyJob *cp=
 	       new CopyJob(c,file->name,"mirror");
-	    if(file->defined&file->DATE)
+	    if((file->defined&file->DATE) && file->date_prec<=1)
 	       cp->SetDate(file->date);
 	    if(file->defined&file->SIZE)
 	       cp->SetSize(file->size);