Commit 10044b1d authored by Xavier Claessens's avatar Xavier Claessens Committed by Nicolas Dufresne

souphttpsrc: Add GTlsInteraction property

https://bugzilla.gnome.org/show_bug.cgi?id=750709
parent 47188709
......@@ -754,7 +754,7 @@ AG_GST_CHECK_FEATURE(SHOUT2, [Shoutcast/Icecast client library], shout2, [
dnl *** soup ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SOUP, true)
AG_GST_CHECK_FEATURE(SOUP, [soup http client plugin (2.4)], souphttpsrc, [
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.40, [HAVE_SOUP="yes"], [HAVE_SOUP="no"])
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.48, [HAVE_SOUP="yes"], [HAVE_SOUP="no"])
AC_SUBST(SOUP_CFLAGS)
AC_SUBST(SOUP_LIBS)
])
......
......@@ -124,7 +124,8 @@ enum
PROP_SSL_USE_SYSTEM_CA_FILE,
PROP_TLS_DATABASE,
PROP_RETRIES,
PROP_METHOD
PROP_METHOD,
PROP_TLS_INTERACTION,
};
#define DEFAULT_USER_AGENT "GStreamer souphttpsrc "
......@@ -136,6 +137,7 @@ enum
#define DEFAULT_SSL_CA_FILE NULL
#define DEFAULT_SSL_USE_SYSTEM_CA_FILE TRUE
#define DEFAULT_TLS_DATABASE NULL
#define DEFAULT_TLS_INTERACTION NULL
#define DEFAULT_TIMEOUT 15
#define DEFAULT_RETRIES 3
#define DEFAULT_SOUP_METHOD NULL
......@@ -380,6 +382,20 @@ gst_soup_http_src_class_init (GstSoupHTTPSrcClass * klass)
"TLS database with anchor certificate authorities used to validate the server certificate",
G_TYPE_TLS_DATABASE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstSoupHTTPSrc::tls-interaction:
*
* A #GTlsInteraction object to be used when the connection or certificate
* database need to interact with the user. This will be used to prompt the
* user for passwords or certificate where necessary.
*
* Since: 1.8
*/
g_object_class_install_property (gobject_class, PROP_TLS_INTERACTION,
g_param_spec_object ("tls-interaction", "TLS interaction",
"A GTlsInteraction object to be used when the connection or certificate database need to interact with the user.",
G_TYPE_TLS_INTERACTION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstSoupHTTPSrc::retries:
*
......@@ -484,6 +500,7 @@ gst_soup_http_src_init (GstSoupHTTPSrc * src)
src->ssl_strict = DEFAULT_SSL_STRICT;
src->ssl_use_system_ca_file = DEFAULT_SSL_USE_SYSTEM_CA_FILE;
src->tls_database = DEFAULT_TLS_DATABASE;
src->tls_interaction = DEFAULT_TLS_INTERACTION;
src->max_retries = DEFAULT_RETRIES;
src->method = DEFAULT_SOUP_METHOD;
proxy = g_getenv ("http_proxy");
......@@ -542,6 +559,9 @@ gst_soup_http_src_finalize (GObject * gobject)
g_object_unref (src->tls_database);
g_free (src->method);
if (src->tls_interaction)
g_object_unref (src->tls_interaction);
G_OBJECT_CLASS (parent_class)->finalize (gobject);
}
......@@ -647,6 +667,10 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id,
g_clear_object (&src->tls_database);
src->tls_database = g_value_dup_object (value);
break;
case PROP_TLS_INTERACTION:
g_clear_object (&src->tls_interaction);
src->tls_interaction = g_value_dup_object (value);
break;
case PROP_RETRIES:
src->max_retries = g_value_get_int (value);
break;
......@@ -736,6 +760,9 @@ gst_soup_http_src_get_property (GObject * object, guint prop_id,
case PROP_TLS_DATABASE:
g_value_set_object (value, src->tls_database);
break;
case PROP_TLS_INTERACTION:
g_value_set_object (value, src->tls_interaction);
break;
case PROP_RETRIES:
g_value_set_int (value, src->max_retries);
break;
......@@ -928,14 +955,15 @@ gst_soup_http_src_session_open (GstSoupHTTPSrc * src)
SOUP_SESSION_TIMEOUT, src->timeout,
SOUP_SESSION_SSL_STRICT, src->ssl_strict,
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
NULL);
SOUP_SESSION_TLS_INTERACTION, src->tls_interaction, NULL);
} else {
src->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
src->context, SOUP_SESSION_PROXY_URI, src->proxy,
SOUP_SESSION_TIMEOUT, src->timeout,
SOUP_SESSION_SSL_STRICT, src->ssl_strict,
SOUP_SESSION_USER_AGENT, src->user_agent, NULL);
SOUP_SESSION_USER_AGENT, src->user_agent,
SOUP_SESSION_TLS_INTERACTION, src->tls_interaction, NULL);
}
if (!src->session) {
......
......@@ -92,6 +92,7 @@ struct _GstSoupHTTPSrc {
gchar *ssl_ca_file;
gboolean ssl_use_system_ca_file;
GTlsDatabase *tls_database;
GTlsInteraction *tls_interaction;
/* Shoutcast/icecast metadata extraction handling. */
gboolean iradio_mode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment