Commons Net
  1. Commons Net
  2. NET-475

FtpClient sends REST when calling listFiles

    Details

      Description

      First setting a restart offset and then requesting a directory listing makes FtpClient send REST, LIST. The correct behavior should be to send only LIST and send REST on the first file transfer operation.

      Versions 3.1 and 3.0.1 of commons-net have shown this behavior in our software.

      Following is a minimal sample, tested with version 3.1:

      package test;
      
      import java.io.PrintWriter;
      
      import org.apache.commons.net.PrintCommandListener;
      import org.apache.commons.net.ftp.FTPClient;
      
      public class Test {
      
      	public static void main(String[] args) throws Exception {
      		FTPClient client = new FTPClient();
      		client.addProtocolCommandListener(new PrintCommandListener(
      				new PrintWriter(System.out), true));
      		
      		client.connect(Server.ip);
      		client.login(Server.username, Server.password);
      		
              client.setRestartOffset(10);
              
              client.listFiles("");
      	}
      	
      }
      

      Output:

      220 Welcome to FTP service.
      USER *******
      331 Please specify the password.
      PASS *******
      230 Login successful.
      SYST
      215 UNIX Type: L8
      PORT 10,43,92,50,230,56
      200 PORT command successful. Consider using PASV.
      REST 10
      350 Restart position accepted (10).
      LIST 
      150 Here comes the directory listing.
      226 Directory send OK.
      

        Activity

        Thomas Axelsson created issue -
        Sebb made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.2 [ 12320140 ]
        Resolution Fixed [ 1 ]
        Sebb made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Thomas Axelsson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development