[librest] Add RestProxy::ssl-ca-file propertyy
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librest] Add RestProxy::ssl-ca-file propertyy
- Date: Fri, 20 Sep 2013 09:45:36 +0000 (UTC)
commit 4d2c76683116156048fa06185ca116bd8458929c
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Sep 16 13:11:04 2013 +0200
Add RestProxy::ssl-ca-file propertyy
This property maps to the SoupSession::ssl-ca-file property, and
allows to specify a file that contains the CAs to use to verify
the certificates we'll get during a TLS session.
rest/rest-proxy.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index a9b91dd..5a67759 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -50,6 +50,7 @@ struct _RestProxyPrivate {
SoupSession *session;
SoupSession *session_sync;
gboolean disable_cookies;
+ char *ssl_ca_file;
};
enum
@@ -61,7 +62,8 @@ enum
PROP_DISABLE_COOKIES,
PROP_USERNAME,
PROP_PASSWORD,
- PROP_SSL_STRICT
+ PROP_SSL_STRICT,
+ PROP_SSL_CA_FILE
};
enum {
@@ -124,6 +126,10 @@ rest_proxy_get_property (GObject *object,
g_value_set_boolean (value, ssl_strict);
break;
}
+ case PROP_SSL_CA_FILE:
+ g_value_set_string (value, priv->ssl_ca_file);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -176,6 +182,10 @@ rest_proxy_set_property (GObject *object,
"ssl-strict", g_value_get_boolean (value),
NULL);
break;
+ case PROP_SSL_CA_FILE:
+ g_free(priv->ssl_ca_file);
+ priv->ssl_ca_file = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -261,6 +271,7 @@ rest_proxy_finalize (GObject *object)
g_free (priv->user_agent);
g_free (priv->username);
g_free (priv->password);
+ g_free (priv->ssl_ca_file);
G_OBJECT_CLASS (rest_proxy_parent_class)->finalize (object);
}
@@ -349,6 +360,15 @@ rest_proxy_class_init (RestProxyClass *klass)
PROP_SSL_STRICT,
pspec);
+ pspec = g_param_spec_string ("ssl-ca-file",
+ "SSL CA file",
+ "File containing SSL CA certificates.",
+ NULL,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class,
+ PROP_SSL_CA_FILE,
+ pspec);
+
/**
* RestProxy::authenticate:
* @proxy: the proxy
@@ -403,6 +423,12 @@ rest_proxy_init (RestProxy *self)
"ssl-ca-file", REST_SYSTEM_CA_FILE,
NULL);
#endif
+ g_object_bind_property (self, "ssl-ca-file",
+ priv->session, "ssl-ca-file",
+ G_BINDING_BIDIRECTIONAL);
+ g_object_bind_property (self, "ssl-ca-file",
+ priv->session_sync, "ssl-ca-file",
+ G_BINDING_BIDIRECTIONAL);
#if WITH_GNOME
soup_session_add_feature_by_type (priv->session,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]