mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
Check if we got a reserved char on url for domain and top level domain
This commit is contained in:
parent
c938935766
commit
3639f03bc6
@ -31,7 +31,7 @@ static inline bool isUnsafeCharUrl(char c)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool isEndOfUrl(char c)
|
||||
static inline bool isCharEndOfUrl(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@ -44,6 +44,22 @@ static inline bool isEndOfUrl(char c)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool isReservedCharUrl(char c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case ';':
|
||||
case '/':
|
||||
case '?':
|
||||
case ':':
|
||||
case '@':
|
||||
case '=':
|
||||
case '&':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Extracts host from given url.
|
||||
inline StringRef getURLHost(const char * data, size_t size)
|
||||
{
|
||||
@ -82,13 +98,13 @@ inline StringRef getURLHost(const char * data, size_t size)
|
||||
start_of_host = pos + 1;
|
||||
else if (*pos == '.')
|
||||
{
|
||||
if (pos + 1 == end || isEndOfUrl(*(pos + 1)))
|
||||
if (pos + 1 == end || isCharEndOfUrl(*(pos + 1)))
|
||||
return StringRef{};
|
||||
has_dot_delimiter = true;
|
||||
}
|
||||
else if (isEndOfUrl(*pos))
|
||||
break;
|
||||
else if (isUnsafeCharUrl(*pos))
|
||||
else if (isUnsafeCharUrl(*pos) || isReservedCharUrl(*pos))
|
||||
return StringRef{};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user