mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
c++-ize the proxy detection code
Just for consistency with the rest
This commit is contained in:
parent
d3bff699aa
commit
bca737dcad
1 changed files with 2 additions and 3 deletions
|
@ -23,7 +23,6 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
@ -35,7 +34,7 @@ namespace nix {
|
||||||
|
|
||||||
static bool haveProxyEnvironmentVariables()
|
static bool haveProxyEnvironmentVariables()
|
||||||
{
|
{
|
||||||
static const char * const proxyVariables[] = {
|
static const std::vector<std::string> proxyVariables = {
|
||||||
"http_proxy",
|
"http_proxy",
|
||||||
"https_proxy",
|
"https_proxy",
|
||||||
"ftp_proxy",
|
"ftp_proxy",
|
||||||
|
@ -44,7 +43,7 @@ static bool haveProxyEnvironmentVariables()
|
||||||
"FTP_PROXY"
|
"FTP_PROXY"
|
||||||
};
|
};
|
||||||
for (auto & proxyVariable: proxyVariables) {
|
for (auto & proxyVariable: proxyVariables) {
|
||||||
if (std::getenv(proxyVariable)) {
|
if (getEnv(proxyVariable).has_value()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue