mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure the runtime works correctly if a Windows user has a proxy server enabled.
This commit is contained in:
parent
1f26953504
commit
6e24cb038a
@ -183,6 +183,43 @@ int main(int argc, char * argv[])
|
||||
QCoreApplication::setOrganizationDomain("pgadmin.org");
|
||||
QCoreApplication::setApplicationName(PGA_APP_NAME.toLower().replace(" ", ""));
|
||||
|
||||
/* In windows and linux, it is required to set application level proxy
|
||||
* becuase socket bind logic to find free port gives socket creation error
|
||||
* when system proxy is configured. We are also setting
|
||||
* "setUseSystemConfiguration"=true to use the system proxy which will
|
||||
* override this application level proxy. As this bug is fixed in Qt 5.9 so
|
||||
* need to set application proxy for Qt version < 5.9.
|
||||
*/
|
||||
#ifndef PGADMIN4_USE_WEBENGINE
|
||||
#if defined (Q_OS_WIN) && QT_VERSION <= 0x050800
|
||||
// Give dummy URL required to find proxy server configured in windows.
|
||||
QNetworkProxyQuery proxyQuery(QUrl("https://www.pgadmin.org"));
|
||||
QNetworkProxy l_proxy;
|
||||
QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(proxyQuery);
|
||||
|
||||
if (listOfProxies.size())
|
||||
{
|
||||
l_proxy = listOfProxies[0];
|
||||
|
||||
// If host name is not empty means proxy server is configured.
|
||||
if (!l_proxy.hostName().isEmpty()) {
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PGADMIN4_USE_WEBENGINE
|
||||
#if defined (Q_OS_LINUX) && QT_VERSION <= 0x050800
|
||||
QByteArray proxy_env;
|
||||
proxy_env = qgetenv("http_proxy");
|
||||
// If http_proxy environment is defined in linux then proxy server is configured.
|
||||
if (!proxy_env.isEmpty()) {
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Display the spash screen
|
||||
QSplashScreen *splash = new QSplashScreen();
|
||||
splash->setPixmap(QPixmap(":/splash.png"));
|
||||
|
Loading…
Reference in New Issue
Block a user