summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendhttp.c
diff options
context:
space:
mode:
authorChristian Kellner <gicmo@gnome.org>2008-02-25 14:55:01 +0000
committerChristian Kellner <gicmo@src.gnome.org>2008-02-25 14:55:01 +0000
commitee880a4f8cd879cdf6e5fc1903705d39334edf3b (patch)
tree0dfa8ffca93b10c8213b4553c11d25931bde4464 /daemon/gvfsbackendhttp.c
parent449a12d950cd25b94a5b4fc29453e41a3e5a9927 (diff)
downloadgvfs-ee880a4f8cd879cdf6e5fc1903705d39334edf3b.tar.gz
- Port the mount operation to use the sync i/op. - Keep the auth
2008-02-25 Christian Kellner <gicmo@gnome.org> * daemon/gvfsbackenddav.c: - Port the mount operation to use the sync i/op. - Keep the auth information around so we can use them again in the case that a subpath requires different authentication. This is needed since libsoup will forgot all auth after a 401. - Ignore trailing slashes in ms_response_is_target (). - Add an initial version of make_directory (). * daemon/gvfsbackendhttp.c: * daemon/gvfsbackendhttp.h: Add message_new_from_filename_full which will add a trailing "/" if is_dir is true. (Saves uneccesary redirects in some cases) Various bits and pieces came from Yann Rouillard. svn path=/trunk/; revision=1368
Diffstat (limited to 'daemon/gvfsbackendhttp.c')
-rw-r--r--daemon/gvfsbackendhttp.c34
1 files changed, 28 insertions, 6 deletions
diff --git a/daemon/gvfsbackendhttp.c b/daemon/gvfsbackendhttp.c
index 824c5531..0789f356 100644
--- a/daemon/gvfsbackendhttp.c
+++ b/daemon/gvfsbackendhttp.c
@@ -79,8 +79,11 @@ g_vfs_backend_http_init (GVfsBackendHttp *backend)
backend->session = soup_session_sync_new ();
}
+
SoupURI *
-g_vfs_backend_uri_for_filename (GVfsBackend *backend, const char *filename)
+g_vfs_backend_uri_for_filename (GVfsBackend *backend,
+ const char *filename,
+ gboolean is_dir)
{
GVfsBackendHttp *op_backend;
SoupURI *uri;
@@ -95,8 +98,15 @@ g_vfs_backend_uri_for_filename (GVfsBackend *backend, const char *filename)
/* Otherwise, we append filename to mount_base (which is assumed to
* be a directory in this case).
+ *
+ * Add a "/" in cases where it is likely that the url is going
+ * to be a directory to avoid redirections
*/
- path = g_build_path ("/", uri->path, filename, NULL);
+ if (is_dir == FALSE || g_str_has_suffix (filename, "/"))
+ path = g_build_path ("/", uri->path, filename, NULL);
+ else
+ path = g_build_path ("/", uri->path, filename, "/", NULL);
+
g_free (uri->path);
uri->path = g_uri_escape_string (path, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH,
FALSE);
@@ -191,20 +201,32 @@ message_new_from_uri (const char *method,
}
SoupMessage *
-message_new_from_filename (GVfsBackend *backend,
- const char *method,
- const char *filename)
+message_new_from_filename_full (GVfsBackend *backend,
+ const char *method,
+ const char *filename,
+ gboolean is_dir)
{
SoupMessage *msg;
SoupURI *uri;
- uri = g_vfs_backend_uri_for_filename (backend, filename);
+ uri = g_vfs_backend_uri_for_filename (backend, filename, is_dir);
msg = message_new_from_uri (method, uri);
soup_uri_free (uri);
return msg;
}
+
+SoupMessage *
+message_new_from_filename (GVfsBackend *backend,
+ const char *method,
+ const char *filename)
+{
+ return message_new_from_filename_full (backend, method, filename, FALSE);
+}
+
+
+
/* ************************************************************************* */
/* virtual functions overrides */