forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetworkProxyLinux.cpp
30 lines (25 loc) · 1021 Bytes
/
NetworkProxyLinux.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidKernel/NetworkProxy.h"
#include <Poco/URI.h>
namespace Mantid::Kernel {
//----------------------------------------------------------------------------------------------
/** Constructor
*/
NetworkProxy::NetworkProxy() : m_logger("network_proxy_logger_generic") {}
ProxyInfo NetworkProxy::getHttpProxy(const std::string & /*unused*/) {
ProxyInfo proxyInfo; // NoProxy.
char *proxy_var = getenv("http_proxy");
if (proxy_var == nullptr)
proxy_var = getenv("HTTP_PROXY");
if (proxy_var != nullptr) {
Poco::URI uri_p(proxy_var);
proxyInfo = ProxyInfo(uri_p.getHost(), uri_p.getPort(), true /*http proxy*/);
}
return proxyInfo;
}
} // namespace Mantid::Kernel