diff options
author | Niels Weber <niels.2.weber@nokia.com> | 2011-03-02 11:19:08 +0100 |
---|---|---|
committer | Niels Weber <niels.2.weber@nokia.com> | 2011-03-02 11:21:21 +0100 |
commit | 403521e127a639d60268684511a4aa58247dcb8e (patch) | |
tree | 7da373e68fe4cbaf7df849808022ae1f90df3570 /installerbuilder/installerbase/installerbase.cpp | |
parent | c95b618588e574913f8c0c7f1bb469120a41d978 (diff) |
linux: honour http_proxy environment variable
Reviewed-by: tjenssen
Diffstat (limited to 'installerbuilder/installerbase/installerbase.cpp')
-rw-r--r-- | installerbuilder/installerbase/installerbase.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/installerbuilder/installerbase/installerbase.cpp b/installerbuilder/installerbase/installerbase.cpp index e30a6c097..f6f92f0cc 100644 --- a/installerbuilder/installerbase/installerbase.cpp +++ b/installerbuilder/installerbase/installerbase.cpp @@ -152,8 +152,18 @@ int main(int argc, char *argv[]) return app.exec(); } - if (args.contains(QLatin1String("--proxy"))) - QNetworkProxyFactory::setUseSystemConfiguration(true); + // Make sure we honor the system's proxy settings + #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + QUrl proxyUrl(QString::fromLatin1(qgetenv("http_proxy"))); + if (proxyUrl.isValid()) { + QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), + proxyUrl.port(), proxyUrl.userName(), proxyUrl.password()); + QNetworkProxy::setApplicationProxy(proxy); + } + #else + if (args.contains(QLatin1String("--proxy"))) + QNetworkProxyFactory::setUseSystemConfiguration(true); + #endif if (args.contains(QLatin1String("--checkupdates"))) { if (runCheck.isRunning(KDRunOnceChecker::ProcessList)) @@ -305,6 +315,16 @@ int main(int argc, char *argv[]) } } + // Make sure we honor the system's proxy settings + #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + QUrl proxyUrl(QString::fromLatin1(qgetenv("http_proxy"))); + if (proxyUrl.isValid()) { + QNetworkProxy proxy(QNetworkProxy::HttpProxy, proxyUrl.host(), + proxyUrl.port(), proxyUrl.userName(), proxyUrl.password()); + QNetworkProxy::setApplicationProxy(proxy); + } + #endif + if (!installer.isInstaller()) installer.setPackageManager(); |