Patch for sitecopy-0.13.4

Bruce Walker <[email protected]>
Newsgroups gmane.comp.web.sitecopy
Organization BorderWare Technologies Inc.
Message-ID <[email protected]>
I started using SiteCopy back in 2002.  Shortly after that I discovered 
intermittent trouble using it with a site that ran NcFTP as their FTP 
server.  I diagnosed the trouble and created a little hack which has 
been working since.  I recently installed the latest version of SiteCopy 
and found that the bug with NcFTP is still there; apparently NcFTP has 
not been fixed after all this time, and apparently none of your other 
users has encountered it.

The problem is that if the remote site is a little out of sync with the 
local copy and sitecopy tries to copy a file to a non-existent remote 
folder (and gets a 550 error), if it then tries to continue with the 
next file, NcFTP messes up the FTP session, gets all out of sync and the 
sitecopy session times-out entirely.  This behaviour repeats until the 
user figures out what folder is missing and manually creates it (ie 
resyncs the remote site).

My fix involves detecting that 550 response and inserting a dummy LIST 
operation.  That re-syncs NcFTP and everything proceeds normally.

So ... in case you're interested, here's my patch (against src/ftp.c) 
for the latest version, sitecopy-0.13.4.

Cheers, and thanks for sitecopy!

_______________________________________________
sitecopy maillist  -  [email protected]
http://dav.lyra.org/mailman/listinfo/sitecopy
SiteCopyNew-ftp.patch (text/plain, 773 B)
# patches sitecopy-0.13.4

*** src/ftp.c.orig	Mon Jun 30 15:20:24 2003
--- src/ftp.c	Sun Jan  9 20:19:52 2005
***************
*** 832,837 ****
--- 832,855 ----
      }
  
      fclose(f);
+ 
+ #ifndef NO_NcFTP_HACK
+     /*
+      * An NcFTP server borks the FTP session if we try to STOR a file
+      * after a 550 response -- Bruce Walker <[email protected]>
+      */
+     if (ret == FTP_FILEBAD) {
+         char tmp[BUFSIZ];
+ 
+         /* execute a LIST and throw away the results */
+         if (ftp_data_open(sess, "LIST foobar_was_here") == FTP_READY) {
+             while (ne_sock_readline(sess->dtpsock, tmp, BUFSIZ) > 0)
+                 ;
+             dtp_close(sess);
+         }
+     }
+ #endif /* NO_NcFTP_HACK */
+ 
      return FTP_ERROR;
  }
bmw.vcf (text/x-vcard, 330 B)
begin:vcard
fn:Bruce Walker
n:Walker;Bruce
org:BorderWare Technologies Inc.;R&D
adr:Suite 502;;50 Burnhamthorpe Rd. West;Mississauga;Ontario;L5B 3C2;Canada
email;internet:[email protected]
title:MXtreme Architect
tel;work:905 804-1855
tel;fax:905 804-1865
x-mozilla-html:TRUE
url:http://www.borderware.com
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.