comparison 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
comparison
equal deleted inserted replaced
955:0f7aeb12e5e9 956:879a634d0a40
15 #include <QDir> 15 #include <QDir>
16 #include <QDebug> 16 #include <QDebug>
17 #include <QStandardPaths> 17 #include <QStandardPaths>
18 #include <QLocale> 18 #include <QLocale>
19 #include <QSaveFile> 19 #include <QSaveFile>
20 #include <QSettings>
20 21
21 #include <polarssl/net.h> 22 #include <polarssl/net.h>
22 #include <polarssl/ssl.h> 23 #include <polarssl/ssl.h>
23 #include <polarssl/entropy.h> 24 #include <polarssl/entropy.h>
24 #include <polarssl/ctr_drbg.h> 25 #include <polarssl/ctr_drbg.h>
48 mResourceList(resourceList), 49 mResourceList(resourceList),
49 mDownloadSW(downloadSW) 50 mDownloadSW(downloadSW)
50 { 51 {
51 #ifdef USE_CURL 52 #ifdef USE_CURL
52 mSSLConnection = new SSLConnectionCurl(url, certificate); 53 mSSLConnection = new SSLConnectionCurl(url, certificate);
54 /* Set up Proxy support. */
55 QSettings settings;
56 QString settingsProxy = settings.value("ProxyURL").toString();
57 if (settingsProxy.isEmpty()) {
58 QByteArray envProxy = qgetenv("http_proxy");
59 if (envProxy.size()) {
60 settingsProxy = QString::fromLocal8Bit(envProxy);
61 }
62 }
63 if (!settingsProxy.isEmpty()) {
64 mSSLConnection->setProxy(QUrl(settingsProxy));
65 }
53 #else 66 #else
54 mSSLConnection = new SSLConnectionBare(url, certificate); 67 mSSLConnection = new SSLConnectionBare(url, certificate);
55 #endif 68 #endif
56 } 69 }
57 70

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