summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-06-14 03:47:58 +0200
committerBenjamin Otte <otte@redhat.com>2011-06-14 03:49:48 +0200
commitad4b1f753866731e6354e367a12b66b9867d5827 (patch)
tree4ec1c6bb7110a4f4e5dd9f4188eb7dd295b8ac3e
parentb1c0ede02d9d1571128a3bac118e4999443fd526 (diff)
downloadgvfs-ad4b1f753866731e6354e367a12b66b9867d5827.tar.gz
ftp: Fix stupid proxy servers disconnecting on FEAT
A bunch of proxy servers assume that the first command sent by an FTP server is USER and if it isn't, they bomb out. We do want to support FEAT-before-USER though so we can do secure FTP (if we ever actually implement it). So we need to make sure we try it at least once and if it fails, we open a new connection and try with USER instead.
-rw-r--r--daemon/gvfsbackendftp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 8cca9805..d24b2596 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -417,6 +417,7 @@ do_mount (GVfsBackend *backend,
GNetworkAddress *addr;
guint port;
+restart:
task.conn = g_vfs_ftp_connection_new (ftp->addr, task.cancellable, &task.error);
/* fail fast here. No need to ask for a password if we know the hostname
* doesn't exist or the given host/port doesn't have an ftp server running.
@@ -429,11 +430,17 @@ do_mount (GVfsBackend *backend,
/* send pre-login commands */
g_vfs_ftp_task_receive (&task, 0, NULL);
- if (!gvfs_backend_ftp_determine_features (&task))
+ if (!g_vfs_backend_ftp_uses_workaround (ftp, G_VFS_FTP_WORKAROUND_FEAT_AFTER_LOGIN) &&
+ !gvfs_backend_ftp_determine_features (&task))
{
- g_vfs_ftp_task_clear_error (&task);
g_vfs_backend_ftp_use_workaround (ftp, G_VFS_FTP_WORKAROUND_FEAT_AFTER_LOGIN);
ftp->features = 0;
+ g_vfs_ftp_task_clear_error (&task);
+ if (!g_vfs_ftp_connection_is_usable (task.conn))
+ {
+ g_vfs_ftp_connection_free (task.conn);
+ goto restart;
+ }
}
addr = G_NETWORK_ADDRESS (ftp->addr);