mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Return scheme logic
This commit is contained in:
parent
56a7595254
commit
331e17d56a
@ -19,7 +19,6 @@ inline StringRef buildFound(const Pos & pos, const Pos & dot_pos, const Pos & st
|
|||||||
if (after_dot == ':' || after_dot == '/' || after_dot == '?' || after_dot == '#')
|
if (after_dot == ':' || after_dot == '/' || after_dot == '?' || after_dot == '#')
|
||||||
return StringRef{};
|
return StringRef{};
|
||||||
|
|
||||||
|
|
||||||
return StringRef(start_of_host, pos - start_of_host);
|
return StringRef(start_of_host, pos - start_of_host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,16 +33,26 @@ inline StringRef getURLHost(const char * data, size_t size)
|
|||||||
if (*(end - 1) == '.')
|
if (*(end - 1) == '.')
|
||||||
return StringRef{};
|
return StringRef{};
|
||||||
|
|
||||||
StringRef scheme = getURLScheme(data, size);
|
|
||||||
if (scheme.size != 0)
|
Pos slash_pos = find_first_symbols<'/'>(pos, end);
|
||||||
|
if (slash_pos != end)
|
||||||
|
pos = slash_pos;
|
||||||
|
else
|
||||||
|
pos = data;
|
||||||
|
|
||||||
|
if (pos != data)
|
||||||
{
|
{
|
||||||
|
StringRef scheme = getURLScheme(data, size);
|
||||||
Pos scheme_end = data + scheme.size;
|
Pos scheme_end = data + scheme.size;
|
||||||
pos = scheme_end + 1;
|
if (pos - scheme_end != 1 || *scheme_end != ':')
|
||||||
if (*scheme_end != ':' || *pos != '/')
|
{
|
||||||
|
std::cerr << "RETURNING HERE\n";
|
||||||
return StringRef{};
|
return StringRef{};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (end - pos > 2 && *pos == '/' && *(pos + 1) == '/')
|
// Check with we still have // character from the scheme
|
||||||
|
if (end - pos > 2 && *(pos) == '/' && *(pos + 1) == '/')
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
auto start_of_host = pos;
|
auto start_of_host = pos;
|
||||||
@ -61,7 +70,7 @@ inline StringRef getURLHost(const char * data, size_t size)
|
|||||||
case '#':
|
case '#':
|
||||||
return buildFound(pos, dot_pos, start_of_host);
|
return buildFound(pos, dot_pos, start_of_host);
|
||||||
case '@': /// myemail@gmail.com
|
case '@': /// myemail@gmail.com
|
||||||
start_of_host = pos;
|
start_of_host = pos + 1;
|
||||||
break;
|
break;
|
||||||
case ' ': /// restricted symbols
|
case ' ': /// restricted symbols
|
||||||
case '\t':
|
case '\t':
|
||||||
|
Loading…
Reference in New Issue
Block a user