bug in mirror, patch attached

"J. Maurice" <[email protected]> Mon, 19 Nov 2007 16:08:21 -0000 (UTC)
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
Dear lftp-devel,

I seem to have come across a bug in lftp's mirror feature:

% lftp -c mirror ftp://ftp.ircd-ratbox.org/pub
ircd-ratbox/devel: Getting directory contents (0) [Waiting for response...]

While trying to fetch this "devel" folder, lftp will always hang while
waiting for the directory listing. This seems to be due to the directory
being empty, and so the server just sends back a 226 reply. Apparently,
lftp is not expecting this, and hangs waiting for the file list.

The following patch seems to workaround the bug:

--- src/ftpclass.cc     Thu Nov  8 16:59:29 2007
+++ src/ftpclass.cc+wiz Tue Nov 20 00:49:10 2007
@@ -3684,6 +3684,13 @@

 void Ftp::CheckResp(int act)
 {
+   if (state == 11 && act == 226) {
+      printf("working-around bug.\n");
+      DataClose();
+      state=EOF_STATE;
+      eof=true;
+   }
+
    // close aborted accepting data socket when the connection is established
    if(is1XX(act) && (flags&PASSIVE_MODE) && conn->aborted_data_sock!=-1)
       conn->CloseAbortedDataConnection();



--
j.maurice /at/ wiz.biz
wiz technologies k.k.