mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
parseAddress: improve parsing of port for IPv6
This commit is contained in:
parent
09020242b2
commit
44c85edae0
@ -28,13 +28,17 @@ std::pair<std::string, UInt16> parseAddress(const std::string & str, UInt16 defa
|
|||||||
throw Exception("Illegal address passed to function parseAddress: "
|
throw Exception("Illegal address passed to function parseAddress: "
|
||||||
"the address begins with opening square bracket, but no closing square bracket found", ErrorCodes::BAD_ARGUMENTS);
|
"the address begins with opening square bracket, but no closing square bracket found", ErrorCodes::BAD_ARGUMENTS);
|
||||||
|
|
||||||
port = find_first_symbols<':'>(closing_square_bracket + 1, end);
|
port = closing_square_bracket + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
port = find_first_symbols<':'>(begin, end);
|
port = find_first_symbols<':'>(begin, end);
|
||||||
|
|
||||||
if (port != end)
|
if (port != end)
|
||||||
{
|
{
|
||||||
|
if (*port != ':')
|
||||||
|
throw Exception(ErrorCodes::BAD_ARGUMENTS,
|
||||||
|
"Illegal port prefix passed to function parseAddress: {}", port);
|
||||||
|
|
||||||
UInt16 port_number;
|
UInt16 port_number;
|
||||||
if (!tryParse<UInt16>(port_number, port + 1))
|
if (!tryParse<UInt16>(port_number, port + 1))
|
||||||
{
|
{
|
||||||
|
@ -6,3 +6,7 @@ SELECT * FROM remote('[::1]:9000', system.one) FORMAT Null;
|
|||||||
SELECT * FROM remote('[::1', system.one) FORMAT Null; -- { serverError 36 }
|
SELECT * FROM remote('[::1', system.one) FORMAT Null; -- { serverError 36 }
|
||||||
SELECT * FROM remote('::1]', system.one) FORMAT Null; -- { serverError 519 }
|
SELECT * FROM remote('::1]', system.one) FORMAT Null; -- { serverError 519 }
|
||||||
SELECT * FROM remote('::1', system.one) FORMAT Null; -- { serverError 519 }
|
SELECT * FROM remote('::1', system.one) FORMAT Null; -- { serverError 519 }
|
||||||
|
|
||||||
|
SELECT * FROM remote('[::1][::1]', system.one) FORMAT Null; -- { serverError 36 }
|
||||||
|
SELECT * FROM remote('[::1][::1', system.one) FORMAT Null; -- { serverError 36 }
|
||||||
|
SELECT * FROM remote('[::1]::1]', system.one) FORMAT Null; -- { serverError 519 }
|
||||||
|
Loading…
Reference in New Issue
Block a user