From 769f91cec6db7c9c5a41db2cf950144f67fc10a8 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 12 Jan 2016 18:07:24 +0000 Subject: [PATCH] Make use of MatrixHTTPAPI:validate-certificate It is also included in the test client as acommand line option. --- src/matrix-http-api.c | 1 + src/test-client.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/matrix-http-api.c b/src/matrix-http-api.c index 726510d..9e97632 100644 --- a/src/matrix-http-api.c +++ b/src/matrix-http-api.c @@ -393,6 +393,7 @@ matrix_http_api_set_validate_certificate(MatrixHTTPAPI *api, MatrixHTTPAPIPrivate *priv = matrix_http_api_get_instance_private(api); priv->validate_certificate = validate_certificate; + g_object_set(priv->soup_session, "ssl-strict", validate_certificate, NULL); } /** diff --git a/src/test-client.c b/src/test-client.c index fe98391..7e7a01a 100644 --- a/src/test-client.c +++ b/src/test-client.c @@ -24,10 +24,12 @@ static gchar *user; static gchar *password; +static gboolean no_validate_certs = FALSE; static GOptionEntry entries[] = { {"user", 'u', 0, G_OPTION_ARG_STRING, &user}, {"password", 'p', 0, G_OPTION_ARG_STRING, &password}, + {"no-validate-certs", 'n', 0, G_OPTION_ARG_NONE, &no_validate_certs}, }; static void @@ -135,6 +137,7 @@ main(int argc, char *argv[]) g_info("Starting up: %s with %s:%s", url, user, password); api = matrix_http_api_new(url, NULL); + matrix_http_api_set_validate_certificate(api, !no_validate_certs); builder = json_builder_new(); json_builder_begin_object(builder); json_builder_set_member_name(builder, "user");