Re: SSL connection terminated without SSL shutdown and most files truncated

"Alexander V. Lukyanov" <[email protected]> Wed, 14 Jan 2009 11:49:30 +0300
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
On Sun, Jan 04, 2009 at 12:59:28AM +0100, Andreas Prieß wrote:
> - With version 3.7.7 most files are corrupted even _without_ parallel
> transmission! With version 3.7.4 every file has an unclean SSL shutdown,
> but the files sha1 sums are ok. With version 3.7.7 most files are
> corrupted. As it seems the files are truncated, missing a few hundred
> bytes, so what ever happened to the SSL connection handling, now it got
> worse.

Here is a patch to fix it.

--
   Alexander.
diff (text/plain, 630 B)
Index: buffer_ssl.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/buffer_ssl.cc,v
retrieving revision 1.15
diff -u -p -r1.15 buffer_ssl.cc
--- buffer_ssl.cc	27 Nov 2008 05:56:34 -0000	1.15
+++ buffer_ssl.cc	14 Jan 2009 08:29:16 -0000
@@ -45,6 +45,8 @@ int IOBufferSSL::Do()
       {
 	 buffer_ptr+=res;
 	 event_time=now;
+	 if(eof)
+	    PutEOF_LL();
 	 return MOVED;
       }
       break;
@@ -114,7 +116,8 @@ int IOBufferSSL::Put_LL(const char *buf,
 
 int IOBufferSSL::PutEOF_LL()
 {
-   ssl->shutdown();
+   if(Size()==0)
+      ssl->shutdown();
    return 0;
 }