URLs with no host



I think there's a problem in the way urls are built.

In get_folder_info() from camel-maildir-store.c we're building a new
maildir URL but we're not setting the host:

/* ... */
CamelURL *url;

url = camel_url_new("maildir:", NULL);
camel_url_set_path(url, ((CamelService *)local_store)->url->path);

if (top == NULL || top[0] == 0 || strlen (top) == 0) {
/* ... */

If you look at camel_url_to_string() from camel-url.c, URLs with no
host are like this: "protocol:path", so we have:

maildir:/home/user/...

There's an assertion in tny-msg.c that makes that crash:

g_assert (strstr (retval, "://") != NULL);

If I'm not wrong URLs with no host should have two slashes ('//')
between the protocol and the path, as in file:///home/user... so I
think the maildir URL should be:

maildir:///home/user/...

I'm attaching a patch against camel-url.c to always append '//' no
matter the value of the hostname

If that's not the proper format of the URL then the assertion is
wrong.

-- 
Alberto García González
http://people.igalia.com/berto/
Index: camel-url.c
===================================================================
--- camel-url.c	(revision 3010)
+++ camel-url.c	(working copy)
@@ -345,10 +345,9 @@
 	str = g_string_sized_new (20);
 
 	if (url->protocol)
-		g_string_append_printf (str, "%s:", url->protocol);
+		g_string_append_printf (str, "%s://", url->protocol);
 
 	if (url->host) {
-		g_string_append (str, "//");
 		if (url->user) {
 			append_url_encoded (str, url->user, ":;@/");
 			if (url->authmech && *url->authmech) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]