summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Matthew <jonathan@d14n.org>2009-01-26 09:51:36 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-01-26 09:55:24 +0100
commit5a0e94b8a75be2e59617af31326bd5defaab0ac5 (patch)
treee1c91c31ad4fc97076aed575a4f2e7691fb3eed8
parent66de4c1bba5b2da9a50218e0f84071a10385e28e (diff)
Use libsoup-gnome for proxy configuration if available
If libsoup-gnome is found use this as it will give us the GNOME proxy configuration. Otherwise use normal libsoup. The GNOME proxy configuration will only be used if the proxy properties are not set on souphttpsrc and if the http_proxy environment variable is not set. Fixes bug #552140.
-rw-r--r--configure.ac11
-rw-r--r--ext/soup/gstsouphttpsrc.c18
2 files changed, 23 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 0f11fb36..2727448c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -836,9 +836,14 @@ 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.3.2, HAVE_SOUP="yes", [
- HAVE_SOUP="no"
- AC_MSG_RESULT(no)
+ PKG_CHECK_MODULES(SOUP, libsoup-gnome-2.4 >= 2.3.2, [
+ HAVE_SOUP="yes"
+ AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [soup gnome integration])
+ ],[
+ PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.3.2, HAVE_SOUP="yes", [
+ HAVE_SOUP="no"
+ AC_MSG_RESULT(no)
+ ])
])
AC_SUBST(SOUP_CFLAGS)
AC_SUBST(SOUP_LIBS)
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index 139d3337..ad7433c1 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -25,6 +25,8 @@
* <para>
* An HTTP proxy must be specified by its URL.
* If the "http_proxy" environment variable is set, its value is used.
+ * If built with libsoup's GNOME integration features, the GNOME proxy
+ * configuration will be used, or failing that, proxy autodetection.
* The element-souphttpsrc::proxy property can be used to override the
* default.
* </para>
@@ -94,7 +96,11 @@
#endif
#include <gst/gstelement.h>
#include <gst/gst-i18n-plugin.h>
+#ifdef HAVE_LIBSOUP_GNOME
+#include <libsoup/soup-gnome.h>
+#else
#include <libsoup/soup.h>
+#endif
#include "gstsouphttpsrc.h"
#include <gst/tag/tag.h>
@@ -1127,15 +1133,21 @@ gst_soup_http_src_start (GstBaseSrc * bsrc)
return FALSE;
}
- if (src->proxy == NULL)
+ if (src->proxy == NULL) {
src->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
- src->context, SOUP_SESSION_USER_AGENT, src->user_agent, NULL);
- else
+ src->context, SOUP_SESSION_USER_AGENT, src->user_agent,
+#ifdef HAVE_LIBSOUP_GNOME
+ SOUP_SESSION_ADD_FEATURE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
+#endif
+ NULL);
+ } else {
src->session =
soup_session_async_new_with_options (SOUP_SESSION_ASYNC_CONTEXT,
src->context, SOUP_SESSION_PROXY_URI, src->proxy,
SOUP_SESSION_USER_AGENT, src->user_agent, NULL);
+ }
+
if (!src->session) {
GST_ELEMENT_ERROR (src, LIBRARY, INIT,
(NULL), ("Failed to create async session"));