summaryrefslogtreecommitdiff
path: root/client/Dialog.cpp
diff options
context:
space:
mode:
authorAlex Borisov <b0ric.alex@gmail.com>2012-02-06 00:22:51 +0200
committerAlex Borisov <b0ric.alex@gmail.com>2012-02-06 00:22:51 +0200
commitf62b8299abb67e69482f0c52359542834967fd73 (patch)
tree0f0e27bbb6d0e04a6169f0d35392b234856d8709 /client/Dialog.cpp
parentb18bd36aed6671eed7c1b985181506c4860b9331 (diff)
FIX: http proxy to be the one and the last in the chain
Diffstat (limited to 'client/Dialog.cpp')
-rw-r--r--client/Dialog.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/client/Dialog.cpp b/client/Dialog.cpp
index e996add..de421dd 100644
--- a/client/Dialog.cpp
+++ b/client/Dialog.cpp
@@ -168,6 +168,26 @@ void ProxyDialog::ProxyToggled(bool on)
if (on)
{
vector<Proxy> active = proxifier->GetActiveProxies();
+
+ // check if we are going to add another http/https proxy
+ if (active.size() != 0)
+ {
+ bool isHttp = (stricmp(proxy->type.c_str(), "http") == 0);
+ for (unsigned i = 0; i < active.size(); i++)
+ {
+ if (isHttp && (stricmp(active[i].type.c_str(), "http") == 0))
+ {
+ QMessageBox otherHttpProxy;
+ otherHttpProxy.setText("Two HTTP proxy in one chain are not allowed");
+ otherHttpProxy.setWindowTitle("Information");
+ otherHttpProxy.setStandardButtons(QMessageBox::Ok);
+ otherHttpProxy.setIcon(QMessageBox::Information);
+ otherHttpProxy.exec();
+ return;
+ }
+ }
+ }
+
for (unsigned i = 0; i < active.size(); i++)
{
ProxyEntryGeneric* genProxy = cfg->GetGenericProxy(active[i].host, active[i].port);
@@ -197,11 +217,34 @@ void ProxyDialog::StaticProxyToggled(bool on)
Logger::Error("Static proxy with name '%s' was not found\n", proxyName.toStdString().c_str());
return;
}
+
Proxifier *proxifier = Proxifier::GetInstance();
if (!proxifier->IsValid())
{
Logger::Fatal("No valid proxifier configuration file found!\n");
}
+
+ // check if we are going to add another http proxy
+ vector<Proxy> active = proxifier->GetActiveProxies();
+ if (on && (active.size() != 0))
+ {
+ bool isHttp = (stricmp(proxy->type.c_str(), "http") == 0);
+ for (unsigned i = 0; i < active.size(); i++)
+ {
+ if (isHttp && (stricmp(active[i].type.c_str(), "http") == 0))
+ {
+ //QString msg = QString::fromLocal8Bit(cfg->ConfigLoadedMsg.c_str());
+ QMessageBox otherHttpProxy;
+ otherHttpProxy.setText("Two HTTP proxy in one chain are not allowed");
+ otherHttpProxy.setWindowTitle("Information");
+ otherHttpProxy.setStandardButtons(QMessageBox::Ok);
+ otherHttpProxy.setIcon(QMessageBox::Information);
+ otherHttpProxy.exec();
+ return;
+ }
+ }
+ }
+
if (on)
{
proxifier->TurnProxyOn(*proxy);