|
|
@ -45,6 +45,7 @@ |
|
|
|
#include "options_imp.h" |
|
|
|
#include "options_imp.h" |
|
|
|
#include "previewSelect.h" |
|
|
|
#include "previewSelect.h" |
|
|
|
#include "allocationDlg.h" |
|
|
|
#include "allocationDlg.h" |
|
|
|
|
|
|
|
#include "stdlib.h" |
|
|
|
|
|
|
|
|
|
|
|
using namespace libtorrent; |
|
|
|
using namespace libtorrent; |
|
|
|
|
|
|
|
|
|
|
@ -851,12 +852,21 @@ void GUI::configureSession(bool deleteOptions) { |
|
|
|
// * Proxy settings
|
|
|
|
// * Proxy settings
|
|
|
|
proxy_settings proxySettings; |
|
|
|
proxy_settings proxySettings; |
|
|
|
if(options->isProxyEnabled()) { |
|
|
|
if(options->isProxyEnabled()) { |
|
|
|
|
|
|
|
proxySettings.hostname = options->getProxyIp().toStdString(); |
|
|
|
|
|
|
|
proxySettings.port = options->getProxyPort(); |
|
|
|
|
|
|
|
if(options->isProxyAuthEnabled()) { |
|
|
|
|
|
|
|
proxySettings.username = options->getProxyUsername().toStdString(); |
|
|
|
|
|
|
|
proxySettings.password = options->getProxyPassword().toStdString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QString proxy_str; |
|
|
|
switch(options->getProxyType()) { |
|
|
|
switch(options->getProxyType()) { |
|
|
|
case HTTP: |
|
|
|
case HTTP: |
|
|
|
proxySettings.type = proxy_settings::http; |
|
|
|
proxySettings.type = proxy_settings::http; |
|
|
|
|
|
|
|
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case HTTP_PW: |
|
|
|
case HTTP_PW: |
|
|
|
proxySettings.type = proxy_settings::http_pw; |
|
|
|
proxySettings.type = proxy_settings::http_pw; |
|
|
|
|
|
|
|
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case SOCKS5: |
|
|
|
case SOCKS5: |
|
|
|
proxySettings.type = proxy_settings::socks5; |
|
|
|
proxySettings.type = proxy_settings::socks5; |
|
|
@ -865,12 +875,12 @@ void GUI::configureSession(bool deleteOptions) { |
|
|
|
proxySettings.type = proxy_settings::socks5_pw; |
|
|
|
proxySettings.type = proxy_settings::socks5_pw; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
proxySettings.hostname = options->getProxyIp().toStdString(); |
|
|
|
if(!proxy_str.isEmpty()) { |
|
|
|
proxySettings.port = options->getProxyPort(); |
|
|
|
// We need this for urllib in search engine plugins
|
|
|
|
if(options->isProxyAuthEnabled()) { |
|
|
|
setenv("http_proxy", proxy_str.toUtf8().data(), 1); |
|
|
|
proxySettings.username = options->getProxyUsername().toStdString(); |
|
|
|
|
|
|
|
proxySettings.password = options->getProxyPassword().toStdString(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
unsetenv("http_proxy"); |
|
|
|
} |
|
|
|
} |
|
|
|
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT()); |
|
|
|
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT()); |
|
|
|
// * Session settings
|
|
|
|
// * Session settings
|
|
|
|