summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2007-10-23 10:06:30 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-10-23 10:06:30 +0000
commit51f680dd72bd8ebecd39d70f521ab4cb97667f3a (patch)
treef4df94822fc897b669ec89bac6defb51d59beda3
parent7c2be725921030667db51449ee178b722aed518e (diff)
downloadgvfs-51f680dd72bd8ebecd39d70f521ab4cb97667f3a.tar.gz
Better handling for default types. (Handle hostname, port and username)
2007-10-23 Alexander Larsson <alexl@redhat.com> * client/gdaemonvfs.c: (_g_daemon_vfs_get_uri_for_mountspec): Better handling for default types. (Handle hostname, port and username) svn path=/trunk/; revision=989
-rw-r--r--ChangeLog7
-rw-r--r--client/gdaemonvfs.c28
2 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0e82fb39..0126266e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-23 Alexander Larsson <alexl@redhat.com>
+
+ * client/gdaemonvfs.c:
+ (_g_daemon_vfs_get_uri_for_mountspec):
+ Better handling for default types.
+ (Handle hostname, port and username)
+
2007-10-22 Alexander Larsson <alexl@redhat.com>
* client/gdaemonvfs.c:
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 3a43a9db..d6c825e0 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -1,5 +1,6 @@
#include <config.h>
#include <string.h>
+#include <stdlib.h>
#include <dbus/dbus.h>
#include "gdaemonvfs.h"
#include "gvfsuriutils.h"
@@ -252,16 +253,25 @@ _g_daemon_vfs_get_uri_for_mountspec (GMountSpec *spec,
if (uri == NULL)
{
- GString *string = g_string_new ("");
- g_string_append (string, type);
- g_string_append (string, "://");
- if (path)
- g_string_append_uri_escaped (string,
- path,
- "!$&'()*+,;=:@/",
- allow_utf8);
+ GDecodedUri decoded;
+ const char *port;
+
+ memset (&decoded, 0, sizeof (decoded));
+ decoded.port = -1;
+
+ decoded.scheme = (char *)type;
+ decoded.host = (char *)g_mount_spec_get (spec, "host");
+ decoded.userinfo = (char *)g_mount_spec_get (spec, "user");
+ port = g_mount_spec_get (spec, "port");
+ if (port != NULL)
+ decoded.port = atoi (port);
+
+ if (path == NULL)
+ decoded.path = "/";
+ else
+ decoded.path = path;
- uri = g_string_free (string, FALSE);
+ uri = g_encode_uri (&decoded, FALSE);
}
return uri;