mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
build poco no proxy only once
This commit is contained in:
parent
3ae8176a6d
commit
70b5457d54
@ -1,6 +1,7 @@
|
||||
#include "EnvironmentProxyConfigurationResolver.h"
|
||||
|
||||
#include <Common/logger_useful.h>
|
||||
#include <Common/proxyConfigurationToPocoProxyConfig.h>
|
||||
#include <Poco/URI.h>
|
||||
|
||||
namespace DB
|
||||
@ -77,7 +78,7 @@ ProxyConfiguration EnvironmentProxyConfigurationResolver::resolve()
|
||||
{
|
||||
static const auto * http_proxy_host = getProxyHost(Protocol::HTTP);
|
||||
static const auto * https_proxy_host = getProxyHost(Protocol::HTTPS);
|
||||
static const auto no_proxy_hosts_string = getNoProxyHostsString();
|
||||
static const auto no_proxy_hosts_string = buildPocoNonProxyHosts(getNoProxyHostsString());
|
||||
|
||||
static const auto http_proxy_configuration = buildProxyConfiguration(Protocol::HTTP, http_proxy_host, no_proxy_hosts_string);
|
||||
static const auto https_proxy_configuration = buildProxyConfiguration(Protocol::HTTPS, https_proxy_host, no_proxy_hosts_string);
|
||||
|
@ -36,6 +36,8 @@ std::string buildPocoRegexpEntryWithoutLeadingDot(const std::string & host)
|
||||
return RE2::QuoteMeta(view_without_leading_dot);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Even though there is not an RFC that defines NO_PROXY, it is usually a comma-separated list of domains.
|
||||
* Different tools implement their own versions of `NO_PROXY` support. Some support CIDR blocks, some support wildcard etc.
|
||||
@ -93,8 +95,6 @@ std::string buildPocoNonProxyHosts(const std::string & no_proxy_hosts_string)
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Poco::Net::HTTPClientSession::ProxyConfig proxyConfigurationToPocoProxyConfig(const DB::ProxyConfiguration & proxy_configuration)
|
||||
{
|
||||
Poco::Net::HTTPClientSession::ProxyConfig poco_proxy_config;
|
||||
@ -104,7 +104,7 @@ Poco::Net::HTTPClientSession::ProxyConfig proxyConfigurationToPocoProxyConfig(co
|
||||
poco_proxy_config.protocol = DB::ProxyConfiguration::protocolToString(proxy_configuration.protocol);
|
||||
poco_proxy_config.tunnel = proxy_configuration.tunneling;
|
||||
poco_proxy_config.originalRequestProtocol = DB::ProxyConfiguration::protocolToString(proxy_configuration.original_request_protocol);
|
||||
poco_proxy_config.nonProxyHosts = buildPocoNonProxyHosts(proxy_configuration.no_proxy_hosts);
|
||||
poco_proxy_config.nonProxyHosts = proxy_configuration.no_proxy_hosts;
|
||||
|
||||
return poco_proxy_config;
|
||||
}
|
||||
|
@ -8,4 +8,6 @@ namespace DB
|
||||
|
||||
Poco::Net::HTTPClientSession::ProxyConfig proxyConfigurationToPocoProxyConfig(const DB::ProxyConfiguration & proxy_configuration);
|
||||
|
||||
std::string buildPocoNonProxyHosts(const std::string & no_proxy_hosts_string);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user