mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Better uri scheme check and fix in poco submodule
This commit is contained in:
parent
01e2137364
commit
f08e090bda
2
contrib/poco
vendored
2
contrib/poco
vendored
@ -1 +1 @@
|
|||||||
Subproject commit d7a4383c4d85b51938b62ed5812bc0935245edb3
|
Subproject commit 20c1d877773b6a672f1bbfe3290dfea42a117ed5
|
@ -396,7 +396,7 @@ namespace ErrorCodes
|
|||||||
extern const int MULTIPLE_ASSIGNMENTS_TO_COLUMN = 419;
|
extern const int MULTIPLE_ASSIGNMENTS_TO_COLUMN = 419;
|
||||||
extern const int CANNOT_UPDATE_COLUMN = 420;
|
extern const int CANNOT_UPDATE_COLUMN = 420;
|
||||||
extern const int CANNOT_ADD_DIFFERENT_AGGREGATE_STATES = 421;
|
extern const int CANNOT_ADD_DIFFERENT_AGGREGATE_STATES = 421;
|
||||||
extern const int UNKNOWN_PROTOCOL = 422;
|
extern const int UNSUPPORTED_URI_SCHEME = 422;
|
||||||
|
|
||||||
extern const int KEEPER_EXCEPTION = 999;
|
extern const int KEEPER_EXCEPTION = 999;
|
||||||
extern const int POCO_EXCEPTION = 1000;
|
extern const int POCO_EXCEPTION = 1000;
|
||||||
|
@ -38,6 +38,7 @@ namespace ErrorCodes
|
|||||||
extern const int RECEIVED_ERROR_FROM_REMOTE_IO_SERVER;
|
extern const int RECEIVED_ERROR_FROM_REMOTE_IO_SERVER;
|
||||||
extern const int RECEIVED_ERROR_TOO_MANY_REQUESTS;
|
extern const int RECEIVED_ERROR_TOO_MANY_REQUESTS;
|
||||||
extern const int FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME;
|
extern const int FEATURE_IS_NOT_ENABLED_AT_BUILD_TIME;
|
||||||
|
extern const int UNSUPPORTED_URI_SCHEME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,6 +53,16 @@ namespace
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isHTTPS(const Poco::URI & uri)
|
||||||
|
{
|
||||||
|
if (uri.getScheme() == "https")
|
||||||
|
return true;
|
||||||
|
else if (uri.getScheme() == "http")
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
throw Exception("Unsupported scheme in URI '" + uri.toString() + "'", ErrorCodes::UNSUPPORTED_URI_SCHEME);
|
||||||
|
}
|
||||||
|
|
||||||
HTTPSessionPtr makeHTTPSessionImpl(const std::string & host, UInt16 port, bool https, bool keep_alive)
|
HTTPSessionPtr makeHTTPSessionImpl(const std::string & host, UInt16 port, bool https, bool keep_alive)
|
||||||
{
|
{
|
||||||
HTTPSessionPtr session;
|
HTTPSessionPtr session;
|
||||||
@ -127,7 +138,7 @@ namespace
|
|||||||
std::unique_lock<std::mutex> lock(mutex);
|
std::unique_lock<std::mutex> lock(mutex);
|
||||||
const std::string & host = uri.getHost();
|
const std::string & host = uri.getHost();
|
||||||
UInt16 port = uri.getPort();
|
UInt16 port = uri.getPort();
|
||||||
bool https = (uri.getScheme() == "https");
|
bool https = isHTTPS(uri);
|
||||||
auto key = std::make_tuple(host, port, https);
|
auto key = std::make_tuple(host, port, https);
|
||||||
auto pool_ptr = endpoints_pool.find(key);
|
auto pool_ptr = endpoints_pool.find(key);
|
||||||
if (pool_ptr == endpoints_pool.end())
|
if (pool_ptr == endpoints_pool.end())
|
||||||
@ -157,7 +168,7 @@ HTTPSessionPtr makeHTTPSession(const Poco::URI & uri, const ConnectionTimeouts &
|
|||||||
{
|
{
|
||||||
const std::string & host = uri.getHost();
|
const std::string & host = uri.getHost();
|
||||||
UInt16 port = uri.getPort();
|
UInt16 port = uri.getPort();
|
||||||
bool https = (uri.getScheme() == "https");
|
bool https = isHTTPS(uri);
|
||||||
|
|
||||||
auto session = makeHTTPSessionImpl(host, port, https, false);
|
auto session = makeHTTPSessionImpl(host, port, https, false);
|
||||||
setTimeouts(*session, timeouts);
|
setTimeouts(*session, timeouts);
|
||||||
|
Loading…
Reference in New Issue
Block a user