[gvfs/gnome-2-26] Bug 580125 – Logging in to a FTP server only works for the 2nd attempt



commit f73de6140a0b52acbaf1406075df227ef42cb8af
Author: Benjamin Otte <otte gnome org>
Date:   Sun Apr 26 14:11:52 2009 +0200

    Bug 580125 â?? Logging in to a FTP server only works for the 2nd attempt
    
    Various fixes for sending the OPTS command:
    1) only send it after we're sure we've read the FEAT response (which
       moves it to after the login)
    2) ignore potential errors from the OPTS command
    
    Also fixes:
    Bug 580124 â?? Copying from FTP crashes
---
 daemon/gvfsbackendftp.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 02e1ac9..e650dd0 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -787,10 +787,6 @@ ftp_connection_prepare (FtpConnection *conn)
     conn->workarounds |= FTP_WORKAROUND_FEAT_AFTER_LOGIN;
     conn->features = 0;
   }
-
-  /* instruct server that we'll give and assume we get utf8 */
-  if (conn->features & FTP_FEATURE_UTF8)
-    ftp_connection_send (conn, 0, "OPTS UTF8 ON");
 }
 
 static gboolean
@@ -822,14 +818,21 @@ ftp_connection_use (FtpConnection *conn)
     if (ftp_connection_send (conn, 0, "FEAT") != 0) {
       ftp_connection_parse_features (conn);
     } else {
-      ftp_connection_clear_error(conn);
+      ftp_connection_clear_error (conn);
       conn->features = FTP_FEATURES_DEFAULT;
     }
   }
 
+  /* instruct server that we'll give and assume we get utf8 */
+  if (conn->features & FTP_FEATURE_UTF8) 
+    {
+      if (!ftp_connection_send (conn, 0, "OPTS UTF8 ON"))
+        ftp_connection_clear_error (conn);
+    }
+
   if (ftp_connection_send (conn, 0, "SYST"))
     ftp_connection_parse_system (conn);
-  ftp_connection_clear_error(conn);
+  ftp_connection_clear_error (conn);
 
   return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]