gvfs r2094 - in trunk: . daemon
- From: otte svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r2094 - in trunk: . daemon
- Date: Mon, 17 Nov 2008 11:21:21 +0000 (UTC)
Author: otte
Date: Mon Nov 17 11:21:21 2008
New Revision: 2094
URL: http://svn.gnome.org/viewvc/gvfs?rev=2094&view=rev
Log:
* daemon/gvfsbackendftp.c: (ftp_connection_parse_features):
Deal with "\n" vs "\r\n" in FEAT responses. Researched by Oliver Joos.
Modified:
trunk/ChangeLog
trunk/daemon/gvfsbackendftp.c
Modified: trunk/daemon/gvfsbackendftp.c
==============================================================================
--- trunk/daemon/gvfsbackendftp.c (original)
+++ trunk/daemon/gvfsbackendftp.c Mon Nov 17 11:21:21 2008
@@ -23,6 +23,7 @@
#include <config.h>
+#include <ctype.h>
#include <errno.h> /* for strerror (EAGAIN) */
#include <stdio.h>
#include <stdlib.h>
@@ -641,19 +642,30 @@
char **supported;
guint i, j;
- supported = g_strsplit (conn->read_buffer, "\r\n", -1);
+ /* The "\n" should really be "\r\n" but we deal with both to handle broken
+ * servers. We strip off '\r' later, if it exists. */
+ supported = g_strsplit (conn->read_buffer, "\n", -1);
for (i = 1; supported[i]; i++)
{
- const char *feature = supported[i];
+ char *feature = supported[i];
+ int len;
+
if (feature[0] != ' ')
continue;
+ feature++;
/* There should just be one space according to RFC2389, but some
* servers have more so we deal with any number of leading spaces.
*/
- while (feature[0] == ' ')
+ while (isspace (feature[0]))
feature++;
+
+ /* strip off trailing '\r', if it exists. */
+ len = strlen(feature);
+ if (len > 0 && feature[len-1] == '\r')
+ feature[len-1] = '\0';
+
for (j = 0; j < G_N_ELEMENTS (features); j++)
{
if (g_ascii_strcasecmp (feature, features[j].name) == 0)
@@ -753,7 +765,7 @@
}
}
-static gboolean
+static void
ftp_connection_prepare (FtpConnection *conn)
{
/* check supported features */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]