Commit 4867a39c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

HTTP win32: use http-proxy options to setup the proxy

Because win32/netconf is not ready

(cherry picked from commit 6514ed05)
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent f9e6eda5
......@@ -56,16 +56,6 @@
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
#define PROXY_TEXT N_("HTTP proxy")
#define PROXY_LONGTEXT N_( \
"HTTP proxy to be used It must be of the form " \
"http://[user@]myproxy.mydomain:myport/ ; " \
"if empty, the http_proxy environment variable will be tried." )
#define PROXY_PASS_TEXT N_("HTTP proxy password")
#define PROXY_PASS_LONGTEXT N_( \
"If your HTTP proxy requires a password, set it here." )
#define RECONNECT_TEXT N_("Auto re-connect")
#define RECONNECT_LONGTEXT N_( \
"Automatically try to reconnect to the stream in case of a sudden " \
......@@ -78,11 +68,6 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_ACCESS )
add_string( "http-proxy", NULL, PROXY_TEXT, PROXY_LONGTEXT,
false )
add_password( "http-proxy-pwd", NULL,
PROXY_PASS_TEXT, PROXY_PASS_LONGTEXT, false )
add_obsolete_bool( "http-use-IE-proxy" )
add_bool( "http-reconnect", false, RECONNECT_TEXT,
RECONNECT_LONGTEXT, true )
/* 'itpc' = iTunes Podcast */
......
......@@ -844,6 +844,16 @@ static const char *const ppsz_prefres[] = {
#define KEY_LONGTEXT N_( \
"This private key file (PEM format) is used for server-side TLS.")
#define PROXY_TEXT N_("HTTP proxy")
#define PROXY_LONGTEXT N_( \
"HTTP proxy to be used It must be of the form " \
"http://[user@]myproxy.mydomain:myport/ ; " \
"if empty, the http_proxy environment variable will be tried." )
#define PROXY_PASS_TEXT N_("HTTP proxy password")
#define PROXY_PASS_LONGTEXT N_( \
"If your HTTP proxy requires a password, set it here." )
#define SOCKS_SERVER_TEXT N_("SOCKS server")
#define SOCKS_SERVER_LONGTEXT N_( \
"SOCKS proxy server to use. This must be of the form " \
......@@ -1802,6 +1812,18 @@ vlc_module_begin ()
add_obsolete_string( "http-crl" ) /* since 3.0.0 */
add_obsolete_string( "sout-http-crl" ) /* since 2.0.0 */
#ifdef _WIN32
add_string( "http-proxy", NULL, PROXY_TEXT, PROXY_LONGTEXT,
false )
add_password( "http-proxy-pwd", NULL,
PROXY_PASS_TEXT, PROXY_PASS_LONGTEXT, false )
#else
add_obsolete_string( "http-proxy" )
add_obsolete_string( "http-proxy-pwd" )
#endif
add_obsolete_bool( "http-use-IE-proxy" )
set_section( N_( "Socks proxy") , NULL )
add_string( "socks", NULL,
SOCKS_SERVER_TEXT, SOCKS_SERVER_LONGTEXT, true )
......
......@@ -27,10 +27,36 @@
#include <vlc_common.h>
#include <vlc_network.h>
#include <vlc_url.h>
char *vlc_getProxyUrl(const char *url)
char *vlc_getProxyUrl(const char *psz_url)
{
char *proxy_url = NULL;
VLC_UNUSED(psz_url);
char *proxy = config_GetPsz( (vlc_object_t *)(NULL), "http-proxy" );
if (proxy == NULL)
return NULL;
char *proxy_pwd = config_GetPsz( (vlc_object_t *)(NULL), "http-proxy-pwd" );
if (proxy_pwd == NULL)
return proxy;
vlc_url_t url;
if (vlc_UrlParse(&url, proxy) < 0) {
free (proxy);
free (proxy_pwd);
return NULL;
}
if (url.psz_password == NULL )
url.psz_password = vlc_uri_encode(proxy_pwd);
char *proxy_url = vlc_uri_compose (&url);
vlc_UrlClean (&url);
free (proxy_pwd);
free (proxy);
#if 0
/* Try to get the proxy server address from Windows internet settings. */
HKEY h_key;
......
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