diff --git a/src/gui/proxyserver_setup.cpp b/src/gui/proxyserver_setup.cpp index d5a0e6734..c4755d86b 100644 --- a/src/gui/proxyserver_setup.cpp +++ b/src/gui/proxyserver_setup.cpp @@ -97,5 +97,16 @@ int CProxySetup::showProxySetup() int res = mn->exec(NULL, ""); delete mn; + + if (g_settings.softupdate_proxyserver == "") + unsetenv("http_proxy"); + else { + std::string proxy = "http://"; + if (g_settings.softupdate_proxyusername != "") + proxy += g_settings.softupdate_proxyusername + ":" + g_settings.softupdate_proxypassword + "@"; + proxy += g_settings.softupdate_proxyserver; + setenv("http_proxy", proxy.c_str(), 1); + } + return res; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a70ad3626..d1a14f960 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -709,6 +709,16 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.softupdate_proxyusername = configfile.getString("softupdate_proxyusername", "" ); g_settings.softupdate_proxypassword = configfile.getString("softupdate_proxypassword", "" ); // + if (g_settings.softupdate_proxyserver == "") + unsetenv("http_proxy"); + else { + std::string proxy = "http://"; + if (g_settings.softupdate_proxyusername != "") + proxy += g_settings.softupdate_proxyusername + ":" + g_settings.softupdate_proxypassword + "@"; + proxy += g_settings.softupdate_proxyserver; + setenv("http_proxy", proxy.c_str(), 1); + } + g_settings.font_file = configfile.getString("font_file", FONTDIR"/neutrino.ttf"); g_settings.ttx_font_file = configfile.getString( "ttx_font_file", FONTDIR"/DejaVuLGCSansMono-Bold.ttf"); ttx_font_file = g_settings.ttx_font_file.c_str(); diff --git a/src/system/ytcache.cpp b/src/system/ytcache.cpp index fdd4818d9..51cf86114 100644 --- a/src/system/ytcache.cpp +++ b/src/system/ytcache.cpp @@ -140,6 +140,14 @@ bool cYTCache::download(MI_MOVIE_INFO *mi) char cerror[CURL_ERROR_SIZE]; curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, cerror); + if(g_settings.softupdate_proxyserver != "") { + curl_easy_setopt(curl, CURLOPT_PROXY, g_settings.softupdate_proxyserver.c_str()); + if(g_settings.softupdate_proxyusername != "") { + std::string tmp = g_settings.softupdate_proxyusername + ":" + g_settings.softupdate_proxypassword; + curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, tmp.c_str()); + } + } + CURLcode res = curl_easy_perform(curl); curl_easy_cleanup(curl); diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 894fe8525..974062984 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -31,7 +31,9 @@ #include #include +#include "settings.h" #include "set_threadname.h" +#include #include "ytparser.h" #include "ytcache.h" @@ -127,6 +129,14 @@ bool cYTFeedParser::getUrl(std::string &url, std::string &answer, CURL *_curl_ha curl_easy_setopt(_curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT); curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1); + if(g_settings.softupdate_proxyserver != "") { + curl_easy_setopt(_curl_handle, CURLOPT_PROXY, g_settings.softupdate_proxyserver.c_str()); + if(g_settings.softupdate_proxyusername != "") { + std::string tmp = g_settings.softupdate_proxyusername + ":" + g_settings.softupdate_proxypassword; + curl_easy_setopt(_curl_handle, CURLOPT_PROXYUSERPWD, tmp.c_str()); + } + } + char cerror[CURL_ERROR_SIZE]; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror); @@ -159,6 +169,14 @@ bool cYTFeedParser::DownloadUrl(std::string &url, std::string &file, CURL *_curl curl_easy_setopt(_curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT); curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1); + if(g_settings.softupdate_proxyserver != "") { + curl_easy_setopt(_curl_handle, CURLOPT_PROXY, g_settings.softupdate_proxyserver.c_str()); + if(g_settings.softupdate_proxyusername != "") { + std::string tmp = g_settings.softupdate_proxyusername + ":" + g_settings.softupdate_proxypassword; + curl_easy_setopt(_curl_handle, CURLOPT_PROXYUSERPWD, tmp.c_str()); + } + } + char cerror[CURL_ERROR_SIZE]; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);