From bc8ac43a54e763b82f726b7de0c7a573fe7417f5 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 16 Nov 2007 20:01:15 +0000 Subject: [PATCH] - BUGFIX: Improved proxy support in search engine (HTTP only) --- Changelog | 1 + TODO | 1 + src/GUI.cpp | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index c09579173..3014bb8e6 100644 --- a/Changelog +++ b/Changelog @@ -69,6 +69,7 @@ - BUGFIX: Removed build dependency on Python - BUGFIX: Catching DHT exception in case there is a problem - BUGFIX: Remember properties window size and position + - BUGFIX: Improved proxy support in search engine (HTTP only) - COSMETIC: Redesigned torrent properties a little - COSMETIC: Totally redesigned program preferences - COSMETIC: Display more logs messages concerning features diff --git a/TODO b/TODO index 43d32761f..cd5185d20 100644 --- a/TODO +++ b/TODO @@ -55,3 +55,4 @@ rc8->final? changelog: - FEATURE: Better media file preview (player detected automatically) - BUGFIX: Remember properties window size and position +- BUGFIX: Improved proxy support in search engine (HTTP only) diff --git a/src/GUI.cpp b/src/GUI.cpp index f7ae291ae..4cb5189c9 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -45,6 +45,7 @@ #include "options_imp.h" #include "previewSelect.h" #include "allocationDlg.h" +#include "stdlib.h" using namespace libtorrent; @@ -824,12 +825,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; @@ -838,12 +848,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