<div dir="ltr">ack<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 6:59 PM, Christophe Fergeau <span dir="ltr"><<a href="mailto:cfergeau@redhat.com" target="_blank">cfergeau@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The 'path' part of the URI will always start with a '/' when present as<br>
this is what separates it from the hostname. When rebuilding the final<br>
URI, the current code inserts a '/' by itself between the hostname and<br>
the path, which results in URIs with an extra '/':<br>
<a href="https://ovirt.example.com//some/path/api" target="_blank">https://ovirt.example.com//some/path/api</a><br>
<br>
This is not only cosmetic as this can cause issues with cookie handling<br>
if libgovirt accesses //some/path/api while the cookie is set for<br>
/some/path/api.<br>
---<br>
 src/remote-viewer.c | 3 ++-<br>
 1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/remote-viewer.c b/src/remote-viewer.c<br>
index fe8b5a3..4320369 100644<br>
--- a/src/remote-viewer.c<br>
+++ b/src/remote-viewer.c<br>
@@ -651,6 +651,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name)<br>
         xmlFreeURI(uri);<br>
         return FALSE;<br>
     }<br>
+    g_return_val_if_fail(*uri->path == '/', FALSE);<br>
<br>
     /* extract VM name from path */<br>
     path_elements = g_strsplit(uri->path, "/", -1);<br>
@@ -667,7 +668,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name)<br>
     /* build final URI */<br>
     rel_path = g_strjoinv("/", path_elements);<br>
     /* FIXME: how to decide between http and https? */<br>
-    *rest_uri = g_strdup_printf("https://%s/%s/api/", uri->server, rel_path);<br>
+    *rest_uri = g_strdup_printf("https://%s%s/api/", uri->server, rel_path);<br>
     *name = vm_name;<br>
     g_free(rel_path);<br>
     g_strfreev(path_elements);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.0<br>
<br>
_______________________________________________<br>
virt-tools-list mailing list<br>
<a href="mailto:virt-tools-list@redhat.com">virt-tools-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/virt-tools-list" target="_blank">https://www.redhat.com/mailman/listinfo/virt-tools-list</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>