Commit d408d54f authored by Dominique Leuenberger's avatar Dominique Leuenberger Committed by Rémi Denis-Courmont

HTTP access: support for libproxy, with configure autodetection

Libproxy can read proxy settings from KDE, GNOME, NetworkManager, or
the environment.
Signed-off-by: default avatarRémi Denis-Courmont <rdenis@simphalempin.com>
parent 6ff7bb03
......@@ -1665,6 +1665,21 @@ then
fi
AM_CONDITIONAL(BUILD_HTTPD, [test "${enable_httpd}" != "no"])
dnl
dnl libproxy support
dnl
AC_ARG_ENABLE(libproxy,
[ --enable-libproxy libproxy support (default auto)])
AS_IF([test "${enable_libproxy}" != "no"], [
AC_CHECK_HEADERS(proxy.h, [
VLC_ADD_LIBS([access_http],[-lproxy])
], [
AS_IF([test "x${enable_libproxy}" != "x"], [
AC_MSG_ERROR([libproxy could not be found on your system])
])
])
])
dnl
dnl VideoLAN manager
dnl
......
......@@ -52,6 +52,9 @@
#include <assert.h>
#ifdef HAVE_PROXY_H
# include "proxy.h"
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
......@@ -315,7 +318,40 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies )
vlc_UrlParse( &p_sys->proxy, psz, 0 );
free( psz );
}
#ifdef HAVE_GETENV
#ifdef HAVE_PROXY_H
else
{
pxProxyFactory *pf = px_proxy_factory_new();
if (pf)
{
char *buf;
int i;
i=asprintf(&buf, "%s://%s", p_access->psz_access, p_access->psz_path);
if (i >= 0)
{
msg_Dbg(p_access, "asking libproxy about url '%s'", buf);
char **proxies = px_proxy_factory_get_proxies(pf, buf);
if (proxies[0])
{
msg_Dbg(p_access, "libproxy suggest to use '%s'", proxies[0]);
if(strcmp(proxies[0],"direct://") != 0)
{
p_sys->b_proxy = true;
vlc_UrlParse( &p_sys->proxy, proxies[0], 0);
}
}
for(i=0;proxies[i];i++) free(proxies[i]);
free(proxies);
free(buf);
px_proxy_factory_free(pf);
}
}
else
{
msg_Err(p_access, "Allocating memory for libproxy failed");
}
}
#elif HAVE_GETENV
else
{
psz = getenv( "http_proxy" );
......
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