[libgovirt] proxy: Only set 'Prefer: persistent-auth' with jsession-id



commit d3683c20e62d889e187406b3fa3fe75e00df228d
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Feb 8 14:51:22 2016 +0100

    proxy: Only set 'Prefer: persistent-auth' with jsession-id
    
    When using an oauth SSO token, this header should not be set.

 govirt/ovirt-proxy.c     |    3 +++
 govirt/ovirt-rest-call.c |    2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index e361635..ef281ae 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -794,6 +794,9 @@ static void ovirt_proxy_set_session_id(OvirtProxy *proxy, const char *session_id
         cookie = soup_cookie_new("JSESSIONID", session_id, domain, "/ovirt-engine/api", -1);
         soup_cookie_jar_add_cookie(proxy->priv->cookie_jar, cookie);
         proxy->priv->jsessionid_cookie = cookie;
+        ovirt_proxy_add_header(proxy, "Prefer", "persistent-auth");
+    } else {
+        ovirt_proxy_add_header(proxy, "Prefer", NULL);
     }
     g_free(url);
 }
diff --git a/govirt/ovirt-rest-call.c b/govirt/ovirt-rest-call.c
index 9e1d9c8..cab3240 100644
--- a/govirt/ovirt-rest-call.c
+++ b/govirt/ovirt-rest-call.c
@@ -127,8 +127,6 @@ static void ovirt_rest_call_constructed(GObject *object)
         } else {
             rest_proxy_call_add_header(REST_PROXY_CALL(object), "Filter", "true");
         }
-        rest_proxy_call_add_header(REST_PROXY_CALL(object),
-                                   "Prefer", "persistent-auth");
         ovirt_proxy_append_additional_headers(proxy, REST_PROXY_CALL(object));
 
         g_object_unref(proxy);


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