0 votes
by (130 points)

I'm trying to run an FTP download with the following code:

var client = FtpConnect(hostName, port, username, password);
client.GetFiles(downloadFilesPath, downloadDirectoryPath, FtpBatchTransferOptions.Recursive, FtpActionOnExistingFiles.OverwriteAll);

Everytime I try to run it I receive the error "Unable to parse server response to SIZE command."

Log Text:

2011-11-02 16:12:48.040 Opening log file.
2011-11-02 16:12:48.061 INFO Ftp(1) Command: TYPE I
2011-11-02 16:12:48.115 INFO Ftp(1) Response: 200 Type set to I.
2011-11-02 16:12:48.115 INFO Ftp(1) Command: SIZE .
2011-11-02 16:12:48.164 INFO Ftp(1) Response: 200 256.
2011-11-02 16:12:48.165 INFO Ftp(1) Command: MDTM .
2011-11-02 16:12:48.220 INFO Ftp(1) Response: 550 Mailbox Not Found.
2011-11-02 16:12:48.220 INFO Ftp(1) Command: MDTM output
2011-11-02 16:12:48.327 INFO Ftp(1) Response: 213 20111101210300
2011-11-02 16:12:48.328 INFO Ftp(1) Command: SIZE output
2011-11-02 16:12:48.396 INFO Ftp(1) Response: 200 256.
2011-11-02 16:12:48.431 ERROR Ftp(1) Info: Rebex.Net.FtpException: Unable to parse server response to SIZE command.
   at wWGvS.CDbthL.IveJUZ(String )
   at Rebex.Net.Ftp.AyBlxCZ(String , Boolean )
   at wWGvS.CnRKLHZ.GetRemoteFileItemInfo(String remotePath, Object expectedRemoteItem)
   at wWGvS.crxgKKZ.CKTDeW(String , Boolean , Boolean , Object )
   at wWGvS.crxgKKZ.CCusdW(Object )
   at wWGvS.crxgKKZ.TransferFiles(Boolean putFile, Object expectedRootItem, CcBEDL pathList, String targetPath, BJXzjV transferOptions, COqSqG existingFileMode)
   at wWGvS.CnRKLHZ.bTGgmEZ(String , String , FtpBatchTransferOptions , FtpActionOnExistingFiles )
   at Rebex.Net.Ftp.GetFiles(String remotePath, String localDirectoryPath, FtpBatchTransferOptions transferOptions, FtpActionOnExistingFiles existingFileMode)

What is causing GetFiles to run a SIZE command, and is there anyway to prevent it from happening?

Applies to: Rebex FTP/SSL
by (70.2k points)

Could you please submit the communication log as described at http://www.rebex.net/kb/logging.aspx? Editing your question or sending it to support@rebex.net would help us determine the source of this error.

1 Answer

+1 vote
by (144k points)

Thanks for the log!

The dot character ('.') at the end of server's SIZE response is causing the error:

2011-11-02 16:12:48.115 INFO Ftp(1) Command: SIZE . 2011-11-02 16:12:48.164 INFO Ftp(1) Response: 200 256.

This particular SIZE command was issued as a part of a detection routine that tries to determine whether SIZE works for directories at this server or not (to see whether it can be used to distinguish files from directories). This is the first time we have seen such response and it seems to be a bug in the server - RFC 3659 clearly defines the syntax without a dot.

We can easily make Rebex FTP ignore the dot, but will have to make a new build first. I will mail you a link when it's ready later today.