mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +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
55 lines
938 B
C++
55 lines
938 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <Common/Exception.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int BAD_ARGUMENTS;
|
|
}
|
|
|
|
struct ProxyConfiguration
|
|
{
|
|
enum class Protocol
|
|
{
|
|
HTTP,
|
|
HTTPS
|
|
};
|
|
|
|
static auto protocolFromString(const std::string & str)
|
|
{
|
|
if (str == "http")
|
|
{
|
|
return Protocol::HTTP;
|
|
}
|
|
else if (str == "https")
|
|
{
|
|
return Protocol::HTTPS;
|
|
}
|
|
|
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unknown proxy protocol: {}", str);
|
|
}
|
|
|
|
static auto protocolToString(Protocol protocol)
|
|
{
|
|
switch (protocol)
|
|
{
|
|
case Protocol::HTTP:
|
|
return "http";
|
|
case Protocol::HTTPS:
|
|
return "https";
|
|
}
|
|
}
|
|
|
|
std::string host;
|
|
Protocol protocol;
|
|
uint16_t port;
|
|
bool tunneling;
|
|
Protocol original_request_protocol;
|
|
};
|
|
|
|
}
|