changeset 426:c5d14dca70c3

2004-3-16 Brian Masney <masneyb@gftp.org> * lib/ftpcommon.h lib/gftp.h lib/rfc959.c src/uicommon/gftpui.c - fixes so that FXP transfers work again
author masneyb
date Tue, 16 Mar 2004 14:50:10 +0000
parents 8fc4efa3f72d
children 3a83011227bc
files ChangeLog lib/ftpcommon.h lib/gftp.h lib/rfc959.c src/uicommon/gftpui.c
diffstat 5 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 16 12:23:54 2004 +0000
+++ b/ChangeLog	Tue Mar 16 14:50:10 2004 +0000
@@ -1,4 +1,7 @@
 2004-3-16 Brian Masney <masneyb@gftp.org>
+	* lib/ftpcommon.h lib/gftp.h lib/rfc959.c src/uicommon/gftpui.c -
+	fixes so that FXP transfers work again
+
 	* src/gtk/misc-gtk.c src/gtk/gftp-gtk.h - added destroy_dialog()
 	function
 
@@ -2283,7 +2286,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.233 2004/03/16 12:23:52 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.234 2004/03/16 14:50:06 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/ftpcommon.h	Tue Mar 16 12:23:54 2004 +0000
+++ b/lib/ftpcommon.h	Tue Mar 16 14:50:10 2004 +0000
@@ -27,8 +27,8 @@
                       * dataconn_rbuf;
   int data_connection;
   unsigned int is_ascii_transfer : 1,
-               sent_retr : 1,
-               encrypted_connection : 1;
+               encrypted_connection : 1,
+               is_fxp_transfer : 1;
   int (*auth_tls_start) (gftp_request * request);
   ssize_t (*data_conn_read) (gftp_request * request, void *ptr, size_t size,
                              int fd);
--- a/lib/gftp.h	Tue Mar 16 12:23:54 2004 +0000
+++ b/lib/gftp.h	Tue Mar 16 14:50:10 2004 +0000
@@ -168,6 +168,9 @@
 #define GFTP_ERETRYABLE_NO_WAIT	-3		/* Temporary failure. The GUI
 						   should not wait and should
 						   reconnect */
+#define GFTP_ENOTRANS		-4		/* Custom error. This is
+						   returned when a FXP transfer
+						   is requested */
 
 /* Some general settings */
 #define BASE_CONF_DIR		"~/.gftp"
--- a/lib/rfc959.c	Tue Mar 16 12:23:54 2004 +0000
+++ b/lib/rfc959.c	Tue Mar 16 14:50:10 2004 +0000
@@ -1107,7 +1107,6 @@
   else
     tempstr++;
 
-  parms->sent_retr = 1;
   return (gftp_parse_file_size (tempstr) + startsize);
 }
 
@@ -1117,9 +1116,9 @@
                  off_t startsize, off_t totalsize)
 {
   char *command, *tempstr, resp;
-  int ret;
   intptr_t passive_transfer;
   rfc959_parms * parms;
+  int ret;
 
   g_return_val_if_fail (request != NULL, GFTP_EFATAL);
   g_return_val_if_fail (filename != NULL, GFTP_EFATAL);
@@ -1181,6 +1180,7 @@
                       const char *tofile, off_t tosize)
 {
   char *tempstr, *pos, *endpos;
+  rfc959_parms * parms;
   int ret;
 
   g_return_val_if_fail (fromreq != NULL, GFTP_EFATAL);
@@ -1190,9 +1190,6 @@
   g_return_val_if_fail (fromreq->datafd > 0, GFTP_EFATAL);
   g_return_val_if_fail (toreq->datafd > 0, GFTP_EFATAL);
 
-  gftp_set_request_option (fromreq, "passive_transfer", GINT_TO_POINTER(1));
-  gftp_set_request_option (toreq, "passive_transfer", GINT_TO_POINTER(0));
-
   if ((ret = rfc959_send_command (fromreq, "PASV\r\n", 1)) != '2')
     return (ret);
 
@@ -1238,6 +1235,12 @@
   if ((ret = rfc959_read_response (toreq, 1)) < 0)
     return (ret);
 
+  parms = fromreq->protocol_data;
+  parms->is_fxp_transfer = 1;
+
+  parms = toreq->protocol_data;
+  parms->is_fxp_transfer = 1;
+
   return (0);
 }
 
@@ -1252,7 +1255,7 @@
   g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL);
 
   parms = request->protocol_data;
-  parms->sent_retr = 0;
+  parms->is_fxp_transfer = 0;
 
   if (parms->data_connection > 0)
     {
@@ -1351,6 +1354,8 @@
   int i, j;
 
   parms = request->protocol_data;
+  if (parms->is_fxp_transfer)
+    return (GFTP_ENOTRANS);
 
   num_read = parms->data_conn_read (request, buf, size, parms->data_connection);
   if (num_read < 0)
@@ -1386,6 +1391,9 @@
 
   parms = request->protocol_data;
 
+  if (parms->is_fxp_transfer)
+    return (GFTP_ENOTRANS);
+
   if (parms->is_ascii_transfer)
     {
       rsize = 0;
--- a/src/uicommon/gftpui.c	Tue Mar 16 12:23:54 2004 +0000
+++ b/src/uicommon/gftpui.c	Tue Mar 16 14:50:10 2004 +0000
@@ -1372,6 +1372,9 @@
                 }
             }
 
+          if (num_read == GFTP_ENOTRANS)
+            num_read = 0;
+
           gftpui_finish_current_file_in_transfer (tdata);
         }