From 6eff005a66160979c99243975b06de3ce01e3dd5 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 17 Nov 2008 11:36:33 +0000 Subject: If feat before login fails, try it again after login. (fixes bug #556786, * daemon/gvfsbackendftp.c: (ftp_connection_prepare), (ftp_connection_use): If feat before login fails, try it again after login. (fixes bug #556786, researched by Oliver Joos) So we're now "better than gftp and filezilla together". Take that gnome-vfs! svn path=/trunk/; revision=2095 --- daemon/gvfsbackendftp.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'daemon') diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c index f76521e8..23234224 100644 --- a/daemon/gvfsbackendftp.c +++ b/daemon/gvfsbackendftp.c @@ -111,6 +111,7 @@ typedef enum { typedef enum { FTP_WORKAROUND_BROKEN_EPSV = (1 << 0), FTP_WORKAROUND_PASV_ADDR = (1 << 1), + FTP_WORKAROUND_FEAT_AFTER_LOGIN = (1 << 2), } FtpWorkarounds; struct _GVfsBackendFtp @@ -769,10 +770,13 @@ static void ftp_connection_prepare (FtpConnection *conn) { /* check supported features */ - if (ftp_connection_send (conn, 0, "FEAT") != 0) + if (ftp_connection_send (conn, 0, "FEAT") != 0) { ftp_connection_parse_features (conn); - else - conn->features = FTP_FEATURES_DEFAULT; + } else { + g_clear_error (&conn->error); + 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) @@ -804,6 +808,15 @@ ftp_connection_use (FtpConnection *conn) g_clear_error (&conn->error); #endif + if (conn->workarounds & FTP_WORKAROUND_FEAT_AFTER_LOGIN) { + if (ftp_connection_send (conn, 0, "FEAT") != 0) { + ftp_connection_parse_features (conn); + } else { + g_clear_error (&conn->error); + conn->features = FTP_FEATURE_EPSV; + } + } + if (ftp_connection_send (conn, 0, "SYST")) ftp_connection_parse_system (conn); g_clear_error (&conn->error); -- cgit v1.2.1