summaryrefslogtreecommitdiff
path: root/ext/soup
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2015-06-10 09:17:08 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-12-14 14:56:02 -0500
commit10044b1d0f4140b1165d3f15807cfa072caef45e (patch)
treec028e7723d8ecfe75eb47de8f751150480bd817c /ext/soup
parent4718870959b1bd31633f64934d0f679a3c99d18b (diff)
souphttpsrc: Add GTlsInteraction property
https://bugzilla.gnome.org/show_bug.cgi?id=750709
Diffstat (limited to 'ext/soup')
-rw-r--r--ext/soup/gstsouphttpsrc.c34
-rw-r--r--ext/soup/gstsouphttpsrc.h1
2 files changed, 32 insertions, 3 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index fe945d5cd..9c652d865 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -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) {
diff --git a/ext/soup/gstsouphttpsrc.h b/ext/soup/gstsouphttpsrc.h
index ef9539cc7..71725817e 100644
--- a/ext/soup/gstsouphttpsrc.h
+++ b/ext/soup/gstsouphttpsrc.h
@@ -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;