summaryrefslogtreecommitdiff
path: root/rest/rest-proxy.c
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-06-08 17:08:35 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2012-06-08 17:27:09 +0200
commitd8db409a6c6d431504cd0a8825a306281bcd10a0 (patch)
treea9982e06a6327b32ba562dd0b5762b4240d46ca2 /rest/rest-proxy.c
parentd2e81c42c766a8d2502dbcf59ec21fd0c22a1369 (diff)
downloadlibrest-d8db409a6c6d431504cd0a8825a306281bcd10a0.tar.gz
Allow to disable libsoup strict SSL check
This is needed in order to access REST services over https using self-signed certificates. https://bugzilla.gnome.org/show_bug.cgi?id=663786
Diffstat (limited to 'rest/rest-proxy.c')
-rw-r--r--rest/rest-proxy.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index b23d29e..4aed44d 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -58,7 +58,8 @@ enum
PROP_USER_AGENT,
PROP_DISABLE_COOKIES,
PROP_USERNAME,
- PROP_PASSWORD
+ PROP_PASSWORD,
+ PROP_SSL_STRICT
};
static gboolean _rest_proxy_simple_run_valist (RestProxy *proxy,
@@ -105,6 +106,14 @@ rest_proxy_get_property (GObject *object,
case PROP_PASSWORD:
g_value_set_string (value, priv->password);
break;
+ case PROP_SSL_STRICT: {
+ gboolean ssl_strict;
+ g_object_get (G_OBJECT(priv->session),
+ "ssl-strict", &ssl_strict,
+ NULL);
+ g_value_set_boolean (value, ssl_strict);
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -149,6 +158,14 @@ rest_proxy_set_property (GObject *object,
g_free (priv->password);
priv->password = g_value_dup_string (value);
break;
+ case PROP_SSL_STRICT:
+ g_object_set (G_OBJECT(priv->session),
+ "ssl-strict", g_value_get_boolean (value),
+ NULL);
+ g_object_set (G_OBJECT(priv->session_sync),
+ "ssl-strict", g_value_get_boolean (value),
+ NULL);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -295,6 +312,15 @@ rest_proxy_class_init (RestProxyClass *klass)
g_object_class_install_property (object_class,
PROP_PASSWORD,
pspec);
+
+ pspec = g_param_spec_boolean ("ssl-strict",
+ "Strictly validate SSL certificates",
+ "Whether certificate errors should be considered a connection error",
+ TRUE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class,
+ PROP_SSL_STRICT,
+ pspec);
}
static void