mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-24 05:25:37 +00:00
- Improved proxy support in search engine
This commit is contained in:
parent
54225cd42f
commit
5484ec923d
20
src/GUI.cpp
20
src/GUI.cpp
@ -45,6 +45,7 @@
|
||||
#include "options_imp.h"
|
||||
#include "previewSelect.h"
|
||||
#include "allocationDlg.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
@ -851,12 +852,21 @@ void GUI::configureSession(bool deleteOptions) {
|
||||
// * Proxy settings
|
||||
proxy_settings proxySettings;
|
||||
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()) {
|
||||
case HTTP:
|
||||
proxySettings.type = proxy_settings::http;
|
||||
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
|
||||
break;
|
||||
case HTTP_PW:
|
||||
proxySettings.type = proxy_settings::http_pw;
|
||||
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
|
||||
break;
|
||||
case SOCKS5:
|
||||
proxySettings.type = proxy_settings::socks5;
|
||||
@ -865,12 +875,12 @@ void GUI::configureSession(bool deleteOptions) {
|
||||
proxySettings.type = proxy_settings::socks5_pw;
|
||||
break;
|
||||
}
|
||||
proxySettings.hostname = options->getProxyIp().toStdString();
|
||||
proxySettings.port = options->getProxyPort();
|
||||
if(options->isProxyAuthEnabled()) {
|
||||
proxySettings.username = options->getProxyUsername().toStdString();
|
||||
proxySettings.password = options->getProxyPassword().toStdString();
|
||||
if(!proxy_str.isEmpty()) {
|
||||
// We need this for urllib in search engine plugins
|
||||
setenv("http_proxy", proxy_str.toUtf8().data(), 1);
|
||||
}
|
||||
} else {
|
||||
unsetenv("http_proxy");
|
||||
}
|
||||
BTSession->setProxySettings(proxySettings, options->useProxyForTrackers(), options->useProxyForPeers(), options->useProxyForWebseeds(), options->useProxyForDHT());
|
||||
// * Session settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user