Re: Large files truncated

"Alexander V. Lukyanov" <[email protected]> Wed, 22 Aug 2007 10:10:26 +0400
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
On Mon, Aug 20, 2007 at 02:28:45PM -0500, [email protected] wrote:
> The problem we're having is large files being truncated in ASCII mode
> when lftp receives a timeout from a server where REST is not supported

Please test this patch.

--
   Alexander.
diff (text/plain, 791 B)
Index: FileCopy.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/FileCopy.cc,v
retrieving revision 1.139
diff -u -p -r1.139 FileCopy.cc
--- FileCopy.cc	16 Aug 2007 15:57:49 -0000	1.139
+++ FileCopy.cc	22 Aug 2007 06:08:54 -0000
@@ -1350,6 +1350,11 @@ int FileCopyPeerFDStream::Do()
       return m;
    }
 
+   bool check_min_size=true;
+#ifndef NATIVE_CRLF
+   if(ascii)
+      check_min_size=false;
+#endif
    switch(mode)
    {
    case PUT:
@@ -1379,7 +1384,7 @@ int FileCopyPeerFDStream::Do()
 	 return m;
       while(Size()>0)
       {
-	 if(!eof && Size()<PUT_LL_MIN
+	 if(check_min_size && !eof && Size()<PUT_LL_MIN
 	 && put_ll_timer && !put_ll_timer->Stopped())
 	    break;
 	 int res=Put_LL(buffer+buffer_ptr,Size());