[libgovirt] Add our own cookie jar to librest soup sessions
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Add our own cookie jar to librest soup sessions
- Date: Wed, 16 Apr 2014 16:22:12 +0000 (UTC)
commit feaedc840f1af4d5ef542980c76d6f3524769713
Author: Christophe Fergeau <cfergeau redhat com>
Date: Wed Dec 11 17:54:08 2013 +0100
Add our own cookie jar to librest soup sessions
This will allow us to inject a JSESSIONID cookie if the user specifies one.
configure.ac | 2 +-
govirt/ovirt-proxy-private.h | 3 +++
govirt/ovirt-proxy.c | 13 +++++++++++++
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 84f5687..24f46cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -101,7 +101,7 @@ AC_SUBST(GLIB_MKENUMS)
GOBJECT_INTROSPECTION_CHECK([1.30.0])
dnl **** Check for librest ****
-PKG_CHECK_MODULES([REST], [rest-0.7 >= 0.7.13])
+PKG_CHECK_MODULES([REST], [rest-0.7 >= 0.7.92])
dnl ---------------------------------------------------------------------------
dnl - Build self tests
diff --git a/govirt/ovirt-proxy-private.h b/govirt/ovirt-proxy-private.h
index 1053ce8..0623552 100644
--- a/govirt/ovirt-proxy-private.h
+++ b/govirt/ovirt-proxy-private.h
@@ -23,6 +23,8 @@
#define __OVIRT_PROXY_PRIVATE_H__
#include <rest/rest-xml-node.h>
+#include <libsoup/soup-cookie-jar.h>
+#include <libsoup/soup-session-feature.h>
#include "ovirt-proxy.h"
#include "ovirt-rest-call.h"
@@ -34,6 +36,7 @@ struct _OvirtProxyPrivate {
char *tmp_ca_file;
gboolean admin_mode;
OvirtApi *api;
+ SoupCookieJar *cookie_jar;
gulong ssl_ca_file_changed_id;
};
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index a44f78c..ccbee67 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -729,6 +729,11 @@ ovirt_proxy_dispose(GObject *obj)
proxy->priv->vms = NULL;
}
+ if (proxy->priv->cookie_jar) {
+ g_object_unref(G_OBJECT(proxy->priv->cookie_jar));
+ proxy->priv->cookie_jar = NULL;
+ }
+
G_OBJECT_CLASS(ovirt_proxy_parent_class)->dispose(obj);
}
@@ -790,12 +795,20 @@ ovirt_proxy_init(OvirtProxy *self)
handler_id = g_signal_connect(G_OBJECT(self), "notify::ssl-ca-file",
(GCallback)ssl_ca_file_changed, NULL);
self->priv->ssl_ca_file_changed_id = handler_id;
+ self->priv->cookie_jar = soup_cookie_jar_new();
+ g_warning("adding cookie jar");
+ rest_proxy_add_soup_feature(REST_PROXY(self),
+ SOUP_SESSION_FEATURE(self->priv->cookie_jar));
}
OvirtProxy *ovirt_proxy_new(const char *uri)
{
+ /* We disable cookies upon OvirtProxy creation as we will be
+ * adding our own cookie jar to OvirtProxy
+ */
return g_object_new(OVIRT_TYPE_PROXY,
"url-format", uri,
+ "disable-cookies", TRUE,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]