Cyberduck Mountain Duck CLI

Ticket #684: pret_patch

File pret_patch, 1.6 KB (added by neothematrix, on Feb 16, 2008 at 12:54:55 PM)

Adds the "PRET" feature to Cyberduck, needed for passive transfers with DistributedFTPD (like DrFTPD)

Line 
1Index: source/com/enterprisedt/net/ftp/FTPClient.java
2===================================================================
3--- source/com/enterprisedt/net/ftp/FTPClient.java      (revision 3480)
4+++ source/com/enterprisedt/net/ftp/FTPClient.java      (working copy)
5@@ -417,12 +417,14 @@
6      * @param append     true if appending, false otherwise
7      */
8     private void initPut(String remoteFile, boolean append) throws IOException, FTPException {
9+        String cmd = append ? "APPE " : "STOR ";
10+        // PRET support
11+        control.sendCommand("PRET "+cmd+remoteFile);
12         // set up data channel
13         data = control.createDataSocket(connectMode);
14         data.setTimeout(timeout);
15 
16         // send the command to store
17-        String cmd = append ? "APPE " : "STOR ";
18         FTPReply reply = control.sendCommand(cmd+remoteFile);
19 
20         // Can get a 125 or a 150
21@@ -436,6 +438,8 @@
22      * @param remoteFile name of remote file
23      */
24     private void initGet(String remoteFile, long resume) throws IOException, FTPException {
25+        // PRET support
26+        control.sendCommand("PRET RETR "+remoteFile);
27         // set up data channel
28         data = control.createDataSocket(connectMode);
29         data.setTimeout(timeout);
30@@ -522,6 +526,9 @@
31      * @return an array of directory listing strings
32      */
33     public BufferedReader dir(String encoding, String command) throws IOException, FTPException {
34+        // PRET support
35+        control.sendCommand("PRET "+command);
36+
37         // set up data channel
38         data = control.createDataSocket(connectMode);
39         data.setTimeout(timeout);