diff ui/downloader.cpp @ 956:879a634d0a40

(issue41) Add proxy support
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 27 Aug 2014 16:31:40 +0200
parents 75085f7adc78
children 2949f1842955
line wrap: on
line diff
--- a/ui/downloader.cpp	Wed Aug 27 16:31:11 2014 +0200
+++ b/ui/downloader.cpp	Wed Aug 27 16:31:40 2014 +0200
@@ -17,6 +17,7 @@
 #include <QStandardPaths>
 #include <QLocale>
 #include <QSaveFile>
+#include <QSettings>
 
 #include <polarssl/net.h>
 #include <polarssl/ssl.h>
@@ -50,6 +51,18 @@
 {
 #ifdef USE_CURL
     mSSLConnection = new SSLConnectionCurl(url, certificate);
+/* Set up Proxy support. */
+    QSettings settings;
+    QString settingsProxy = settings.value("ProxyURL").toString();
+    if (settingsProxy.isEmpty()) {
+        QByteArray envProxy = qgetenv("http_proxy");
+        if (envProxy.size()) {
+            settingsProxy = QString::fromLocal8Bit(envProxy);
+        }
+    }
+    if (!settingsProxy.isEmpty()) {
+        mSSLConnection->setProxy(QUrl(settingsProxy));
+    }
 #else
     mSSLConnection = new SSLConnectionBare(url, certificate);
 #endif

http://wald.intevation.org/projects/trustbridge/