diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2017-06-20 16:39:36 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2017-11-09 09:51:50 +0100 |
commit | b00af80c5acce0298fb5977365942ce907b4e49c (patch) | |
tree | a5e4fdf69f9b19f6136606e9c3fad1d939418ba0 | |
parent | 6c6e3f1640568a5c64337fd54684e726952c3ea7 (diff) | |
download | gstreamer-plugins-good-b00af80c5acce0298fb5977365942ce907b4e49c.tar.gz |
tests: souphttpsrc: Avoid deprecated ssl-ca-file property
SoupSession's ssl-ca-file property is deprecated. Use the recommended
tls-database property.
This is a bit more complex as it requires creating a GTlsFileDatabase
object for an absolute (!) path to the CA certificates file.
https://bugzilla.gnome.org/show_bug.cgi?id=784005
-rw-r--r-- | tests/check/elements/souphttpsrc.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/check/elements/souphttpsrc.c b/tests/check/elements/souphttpsrc.c index d5eefb936..40d4dbbb6 100644 --- a/tests/check/elements/souphttpsrc.c +++ b/tests/check/elements/souphttpsrc.c @@ -125,8 +125,29 @@ run_test (gboolean use_https, const gchar * path, gint expected) g_object_set (src, "location", url, NULL); g_free (url); + if (use_https) { + GTlsDatabase *tlsdb; + GError *error = NULL; + gchar *path; + + /* GTlsFileDatabase needs an absolute path. Using a relative one + * causes a warning from GLib-Net followed by a segfault in GnuTLS */ + if (g_path_is_absolute (ssl_cert_file)) { + path = g_strdup (ssl_cert_file); + } else { + path = g_build_filename (g_get_current_dir (), ssl_cert_file, NULL); + } + + tlsdb = g_tls_file_database_new (path, &error); + fail_unless (tlsdb, "Failed to load certificate: %s", error->message); + + g_object_set (src, "tls-database", tlsdb, NULL); + + g_object_unref (tlsdb); + g_free (path); + } + g_object_set (src, "automatic-redirect", redirect, NULL); - g_object_set (src, "ssl-ca-file", ssl_cert_file, NULL); if (cookies != NULL) g_object_set (src, "cookies", cookies, NULL); g_object_set (sink, "signal-handoffs", TRUE, NULL); |