summaryrefslogtreecommitdiffstats
path: root/installerbuilder/installerbase/installerbase.cpp
diff options
context:
space:
mode:
authorNiels Weber <niels.2.weber@nokia.com>2011-03-02 11:19:08 +0100
committerNiels Weber <niels.2.weber@nokia.com>2011-03-02 11:21:21 +0100
commit403521e127a639d60268684511a4aa58247dcb8e (patch)
tree7da373e68fe4cbaf7df849808022ae1f90df3570 /installerbuilder/installerbase/installerbase.cpp
parentc95b618588e574913f8c0c7f1bb469120a41d978 (diff)
linux: honour http_proxy environment variable
Reviewed-by: tjenssen
Diffstat (limited to 'installerbuilder/installerbase/installerbase.cpp')
-rw-r--r--installerbuilder/installerbase/installerbase.cpp24
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();