mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
b6e205dcdf
* initial commit. integ tests passing, need to re-run unit & my own personal tests * partial refactoring to remove Protocol::ANY * improve naming * remove all usages of ProxyConfiguration::Protocol::ANY * fix ut * blabla * support url functions as well * support for HTTPS requests over HTTP proxy with tunneling off * remove gtestabc * fix silly mistake * ... * remove usages of httpclientsession::proxyconfig in src/ * got you * remove stale comment * it seems like I need reasonable defaults * fix ut * add some comments * remove no longer needed header * matrix out * add https over http proxy with no tunneling * soem docs * partial refactoring * rename to use_tunneling_for_https_requests_over_http_proxy * improve docs * use shorter version * remove useless test * rename the setting * update * fix typo * fix setting docs typo * move ); up * move ) up
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <base/types.h>
|
|
|
|
#include <mutex>
|
|
|
|
#include <Common/ProxyConfigurationResolver.h>
|
|
#include <Poco/URI.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/*
|
|
* Makes an HTTP GET request to the specified endpoint to obtain a proxy host.
|
|
* */
|
|
class RemoteProxyConfigurationResolver : public ProxyConfigurationResolver
|
|
{
|
|
public:
|
|
|
|
struct RemoteServerConfiguration
|
|
{
|
|
Poco::URI endpoint;
|
|
String proxy_protocol;
|
|
unsigned proxy_port;
|
|
unsigned cache_ttl_;
|
|
};
|
|
|
|
RemoteProxyConfigurationResolver(
|
|
const RemoteServerConfiguration & remote_server_configuration_,
|
|
Protocol request_protocol_,
|
|
bool disable_tunneling_for_https_requests_over_http_proxy_ = true);
|
|
|
|
ProxyConfiguration resolve() override;
|
|
|
|
void errorReport(const ProxyConfiguration & config) override;
|
|
|
|
private:
|
|
RemoteServerConfiguration remote_server_configuration;
|
|
|
|
std::mutex cache_mutex;
|
|
bool cache_valid = false;
|
|
std::chrono::time_point<std::chrono::system_clock> cache_timestamp;
|
|
const std::chrono::seconds cache_ttl{0};
|
|
ProxyConfiguration cached_config;
|
|
};
|
|
|
|
}
|