[libgovirt] Don't try to set NULL jsessionid



commit 7870da16f39dee1aa428838d0f482d61e5d84738
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Thu Oct 9 15:19:33 2014 +0200

    Don't try to set NULL jsessionid
    
    This causes warnings from libsoup.

 govirt/ovirt-proxy.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index e243d83..f1b88cb 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -697,7 +697,6 @@ static void ovirt_proxy_get_property(GObject *object,
 
 static void ovirt_proxy_set_session_id(OvirtProxy *proxy, const char *session_id)
 {
-    SoupCookie *cookie;
     char *url;
     char *domain;
 
@@ -711,9 +710,12 @@ static void ovirt_proxy_set_session_id(OvirtProxy *proxy, const char *session_id
 
     g_free(proxy->priv->jsessionid);
     proxy->priv->jsessionid = g_strdup(session_id);
-    cookie = soup_cookie_new("JSESSIONID", session_id, domain, "/api", -1);
+    if (proxy->priv->jsessionid != NULL) {
+        SoupCookie *cookie;
+        cookie = soup_cookie_new("JSESSIONID", session_id, domain, "/api", -1);
+        soup_cookie_jar_add_cookie(proxy->priv->cookie_jar, cookie);
+    }
     g_free(url);
-    soup_cookie_jar_add_cookie(proxy->priv->cookie_jar, cookie);
 }
 
 


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