Blame SOURCES/0001-proxy-Fix-persistent-session-with-oVirt-3.6.patch

2bd53e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2bd53e
From: Christophe Fergeau <cfergeau@redhat.com>
2bd53e
Date: Tue, 14 Jun 2016 14:38:07 +0200
2bd53e
Subject: [PATCH] proxy: Fix persistent session with oVirt 3.6
2bd53e
2bd53e
commit d3683c2 "proxy: Only set 'Prefer: persistent-auth' with
2bd53e
jsession-id"  was working as expected when using the
2bd53e
OvirtProxy::jsession-id and OvirtProxy::sso-token properties.
2bd53e
2bd53e
However, when not using these properties and expecting the jsessionid to
2bd53e
be set as a cookie during a regular HTTP session, this was not working
2bd53e
properly as oVirt is not sending a jsessionid cookie when Prefer:
2bd53e
persistent-auth is not set.
2bd53e
2bd53e
Consequently, we need to set it upon OvirtProxy creation in order not to
2bd53e
break this usecase. We don't add the header in RestProxyCall as was done
2bd53e
before as we want to be able to disable this addition after
2bd53e
OvirtProxy::sso-token has been set.
2bd53e
---
2bd53e
 govirt/ovirt-proxy.c | 5 ++---
2bd53e
 1 file changed, 2 insertions(+), 3 deletions(-)
2bd53e
2bd53e
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
4dfa2a
index fc0273f..08e42d2 100644
2bd53e
--- a/govirt/ovirt-proxy.c
2bd53e
+++ b/govirt/ovirt-proxy.c
4dfa2a
@@ -801,9 +801,6 @@ static void ovirt_proxy_set_session_id(OvirtProxy *proxy, const char *session_id
2bd53e
         cookie = soup_cookie_new("JSESSIONID", session_id, domain, "/ovirt-engine/api", -1);
2bd53e
         soup_cookie_jar_add_cookie(proxy->priv->cookie_jar, cookie);
2bd53e
         proxy->priv->jsessionid_cookie = cookie;
2bd53e
-        ovirt_proxy_add_header(proxy, "Prefer", "persistent-auth");
2bd53e
-    } else {
2bd53e
-        ovirt_proxy_add_header(proxy, "Prefer", NULL);
2bd53e
     }
2bd53e
     g_free(url);
2bd53e
 }
4dfa2a
@@ -815,6 +812,7 @@ static void ovirt_proxy_set_sso_token(OvirtProxy *proxy, const char *sso_token)
2bd53e
     g_free(proxy->priv->sso_token);
2bd53e
     proxy->priv->sso_token = g_strdup(sso_token);
2bd53e
 
2bd53e
+    ovirt_proxy_add_header(proxy, "Prefer", NULL);
2bd53e
     header_value = g_strdup_printf("Bearer %s", sso_token);
2bd53e
     ovirt_proxy_add_header(proxy, "Authorization", header_value);
2bd53e
     g_free(header_value);
4dfa2a
@@ -903,6 +901,7 @@ static void ovirt_proxy_constructed(GObject *gobject)
2bd53e
         g_warning("Disabling strict checking of SSL certificates");
2bd53e
         g_object_set(OVIRT_PROXY(gobject), "ssl-strict", FALSE, NULL);
2bd53e
     }
2bd53e
+    ovirt_proxy_add_header(OVIRT_PROXY(gobject), "Prefer", "persistent-auth");
2bd53e
 
2bd53e
     /* Chain up to the parent class */
2bd53e
     if (G_OBJECT_CLASS(ovirt_proxy_parent_class)->constructed)