summaryrefslogtreecommitdiffstats
path: root/src/remote-viewer.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-04-16 13:56:48 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-08-18 13:20:42 +0200
commit914f75ee8d2264cb2fd4276a3a935f2f7bbfbc82 (patch)
treead46025a09a967f3b6d5e80376ca7d72c85d4481 /src/remote-viewer.c
parent49abd71dae12d2b284aee7d6c9c8213b22738b19 (diff)
downloadvirt-viewer-914f75ee8d2264cb2fd4276a3a935f2f7bbfbc82.tar.gz
virt-viewer-914f75ee8d2264cb2fd4276a3a935f2f7bbfbc82.tar.xz
virt-viewer-914f75ee8d2264cb2fd4276a3a935f2f7bbfbc82.zip
ovirt: Remove extra '/' from oVirt URI
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.
Diffstat (limited to 'src/remote-viewer.c')
-rw-r--r--src/remote-viewer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index a27a165..2a21d93 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -649,6 +649,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name, char** usern
xmlFreeURI(uri);
return FALSE;
}
+ g_return_val_if_fail(*uri->path == '/', FALSE);
/* extract VM name from path */
path_elements = g_strsplit(uri->path, "/", -1);
@@ -668,7 +669,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name, char** usern
/* 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);