Re: [virt-viewer 1/7] ovirt: Remove extra '/' from oVirt URI

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

 



ack


On Wed, Apr 16, 2014 at 6:59 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
The 'path' part of the URI will always start with a '/' when present as
this is what separates it from the hostname. When rebuilding the final
URI, the current code inserts a '/' by itself between the hostname and
the path, which results in URIs with an extra '/':
https://ovirt.example.com//some/path/api

This is not only cosmetic as this can cause issues with cookie handling
if libgovirt accesses //some/path/api while the cookie is set for
/some/path/api.
---
 src/remote-viewer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index fe8b5a3..4320369 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -651,6 +651,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name)
         xmlFreeURI(uri);
         return FALSE;
     }
+    g_return_val_if_fail(*uri->path == '/', FALSE);

     /* extract VM name from path */
     path_elements = g_strsplit(uri->path, "/", -1);
@@ -667,7 +668,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name)
     /* build final URI */
     rel_path = g_strjoinv("/", path_elements);
     /* FIXME: how to decide between http and https? */
-    *rest_uri = g_strdup_printf("https://%s/%s/api/", uri->server, rel_path);
+    *rest_uri = g_strdup_printf("https://%s%s/api/", uri->server, rel_path);
     *name = vm_name;
     g_free(rel_path);
     g_strfreev(path_elements);
--
1.9.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



--
Marc-André Lureau
_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux