[PATCH 6/8] Do FEAT and OPTS UTF8 ON before login.
- From: Andreas Henriksson <andreas fatal se>
- To: gvfs-list gnome org
- Cc: Andreas Henriksson <andreas fatal se>, Oliver <oliver joos schweiz org>, Benjamin Otte <otte gnome org>
- Subject: [PATCH 6/8] Do FEAT and OPTS UTF8 ON before login.
- Date: Sat, 15 Nov 2008 18:03:47 +0100
- this is how lftp does it...
---
daemon/gvfsbackendftp.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index bddab49..c4b45d1 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -749,21 +749,26 @@ ftp_connection_parse_system (FtpConnection *conn)
}
static gboolean
-ftp_connection_use (FtpConnection *conn)
+ftp_connection_prepare (FtpConnection *conn)
{
- /* only binary transfers please */
- ftp_connection_send (conn, 0, "TYPE I");
- if (ftp_connection_in_error (conn))
- return FALSE;
-
/* check supported features */
if (ftp_connection_send (conn, 0, "FEAT") != 0)
ftp_connection_parse_features (conn);
else
conn->features = FTP_FEATURES_DEFAULT;
+ /* 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
+ftp_connection_use (FtpConnection *conn)
+{
+ /* only binary transfers please */
+ ftp_connection_send (conn, 0, "TYPE I");
+ if (ftp_connection_in_error (conn))
+ return FALSE;
/* RFC 2428 suggests to send this to make NAT routers happy */
#if 0
@@ -1279,6 +1284,7 @@ g_vfs_backend_ftp_pop_connection (GVfsBackendFtp *ftp,
ftp->connections++;
g_mutex_unlock (ftp->mutex);
conn = ftp_connection_create (ftp->addr, job);
+ ftp_connection_prepare (conn);
ftp_connection_login (conn, ftp->user, ftp->password);
ftp_connection_use (conn);
if (!ftp_connection_in_error (conn))
@@ -1393,6 +1399,8 @@ do_mount (GVfsBackend *backend,
return;
}
+ ftp_connection_prepare (conn);
+
port = soup_address_get_port (ftp->addr);
/* FIXME: need to translate this? */
if (port == 21)
--
1.5.6.5
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]