mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
add http proxy support for yt
Conflicts: src/gui/proxyserver_setup.cpp src/neutrino.cpp src/system/httptool.cpp src/system/settings.h
This commit is contained in:
@@ -97,5 +97,16 @@ int CProxySetup::showProxySetup()
|
|||||||
|
|
||||||
int res = mn->exec(NULL, "");
|
int res = mn->exec(NULL, "");
|
||||||
delete mn;
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -709,6 +709,16 @@ int CNeutrinoApp::loadSetup(const char * fname)
|
|||||||
g_settings.softupdate_proxyusername = configfile.getString("softupdate_proxyusername", "" );
|
g_settings.softupdate_proxyusername = configfile.getString("softupdate_proxyusername", "" );
|
||||||
g_settings.softupdate_proxypassword = configfile.getString("softupdate_proxypassword", "" );
|
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.font_file = configfile.getString("font_file", FONTDIR"/neutrino.ttf");
|
||||||
g_settings.ttx_font_file = configfile.getString( "ttx_font_file", FONTDIR"/DejaVuLGCSansMono-Bold.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();
|
ttx_font_file = g_settings.ttx_font_file.c_str();
|
||||||
|
@@ -140,6 +140,14 @@ bool cYTCache::download(MI_MOVIE_INFO *mi)
|
|||||||
char cerror[CURL_ERROR_SIZE];
|
char cerror[CURL_ERROR_SIZE];
|
||||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, cerror);
|
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);
|
CURLcode res = curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
|
||||||
|
@@ -31,7 +31,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <OpenThreads/ScopedLock>
|
#include <OpenThreads/ScopedLock>
|
||||||
|
#include "settings.h"
|
||||||
#include "set_threadname.h"
|
#include "set_threadname.h"
|
||||||
|
#include <global.h>
|
||||||
|
|
||||||
#include "ytparser.h"
|
#include "ytparser.h"
|
||||||
#include "ytcache.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_TIMEOUT, URL_TIMEOUT);
|
||||||
curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1);
|
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];
|
char cerror[CURL_ERROR_SIZE];
|
||||||
curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);
|
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_TIMEOUT, URL_TIMEOUT);
|
||||||
curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1);
|
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];
|
char cerror[CURL_ERROR_SIZE];
|
||||||
curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);
|
curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user