summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-04-25 15:33:40 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2014-08-27 17:35:46 +0200
commitaacef5693171592a632cef8f9374ccef2ed40eae (patch)
treeb09e0695cf6da668e67bce6cd5015279c7f15525
parentd007792758b84629ec67b431da8136fc0c51a023 (diff)
Ignore '/' at beginning of REST function
When building the HTTP URL to access for a REST operation, RestProxyCall::prepare_message, a '/' at the end of the base URL is ignored, but a '/' at the beginning of the REST function is not. When interacting with the oVirt REST API, I often end up building calls with for example 'https://ovirt.example.com' as the base URI, and '/api/vms/' as the function, which then leads to an URI with 2 '/': 'https://ovirt.example.com//api/vms' https://bugzilla.gnome.org/show_bug.cgi?id=728952 (cherry picked from commit d54c36cc22c365bd21936365f7c9410899ad3ec1)
-rw-r--r--rest/rest-proxy-call.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
index 62079f4..b2dbb65 100644
--- a/rest/rest-proxy-call.c
+++ b/rest/rest-proxy-call.c
@@ -740,7 +740,8 @@ prepare_message (RestProxyCall *call, GError **error_out)
/* FIXME: Perhaps excessive memory duplication */
if (priv->function)
{
- if (g_str_has_suffix (bound_url, "/"))
+ if (g_str_has_suffix (bound_url, "/")
+ || g_str_has_prefix (priv->function, "/"))
{
priv->url = g_strdup_printf ("%s%s", bound_url, priv->function);
} else {