Skip to content

Commit

Permalink
Allow SOCKS proxy to be supplied via http_proxy env var
Browse files Browse the repository at this point in the history
  • Loading branch information
normanr committed Apr 15, 2023
1 parent 8383da0 commit fe8cdad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/StelApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ void StelApp::setupNetworkProxy()
QString proxyPass = confSettings->value("proxy/password").toString();
QString proxyType = confSettings->value("proxy/type").toString();

bool useSocksProxy = proxyType.contains("socks", Qt::CaseInsensitive);

// If proxy settings not found in config, use environment variable
// if it is defined. (Config file over-rides environment).
if (proxyHost.isEmpty() && proxyUser.isEmpty() && proxyPass.isEmpty() && proxyPort.isEmpty())
Expand All @@ -365,6 +363,7 @@ void StelApp::setupNetworkProxy()
QRegularExpressionMatch preMatch=pre.match(proxyString);
if (proxyString.indexOf(pre) >= 0)
{
proxyType = preMatch.captured(1);
proxyUser = preMatch.captured(2);
proxyPass = preMatch.captured(3);
proxyHost = preMatch.captured(4);
Expand All @@ -379,6 +378,8 @@ void StelApp::setupNetworkProxy()
}
}

bool useSocksProxy = proxyType.contains("socks", Qt::CaseInsensitive);

if (!proxyHost.isEmpty())
{
QNetworkProxy proxy;
Expand Down

0 comments on commit fe8cdad

Please sign in to comment.