Make use of MatrixHTTPAPI:validate-certificate

It is also included in the test client as acommand line option.
This commit is contained in:
Gergely Polonkai 2016-01-12 18:07:24 +00:00
parent 2a96aaa6af
commit 769f91cec6
2 changed files with 4 additions and 0 deletions

View File

@ -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);
}
/**

View File

@ -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");