mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Better scheme cut
This commit is contained in:
parent
48451b2b0f
commit
fa88954e56
@ -32,23 +32,19 @@ inline StringRef getURLHost(const char * data, size_t size)
|
|||||||
Pos end = data + size;
|
Pos end = data + size;
|
||||||
|
|
||||||
Pos slash_pos = find_first_symbols<'/'>(pos, end);
|
Pos slash_pos = find_first_symbols<'/'>(pos, end);
|
||||||
if (slash_pos != end)
|
if (slash_pos < end - 1 && *(slash_pos + 1) == '/')
|
||||||
pos = slash_pos;
|
pos = slash_pos + 2;
|
||||||
else
|
else
|
||||||
pos = data;
|
pos = data;
|
||||||
|
|
||||||
if (pos != data)
|
if (pos != data)
|
||||||
{
|
{
|
||||||
StringRef scheme = getURLScheme(data, size);
|
StringRef scheme = getURLScheme(data, end - pos);
|
||||||
Pos scheme_end = data + scheme.size;
|
Pos scheme_end = data + scheme.size;
|
||||||
if (pos - scheme_end != 1 || *scheme_end != ':')
|
if (scheme.size && (pos - scheme_end != 3 || *scheme_end != ':'))
|
||||||
return StringRef{};
|
return StringRef{};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check with we still have // character from the scheme
|
|
||||||
if (end - pos > 2 && *(pos) == '/' && *(pos + 1) == '/')
|
|
||||||
pos += 2;
|
|
||||||
|
|
||||||
auto start_of_host = pos;
|
auto start_of_host = pos;
|
||||||
Pos dot_pos = nullptr;
|
Pos dot_pos = nullptr;
|
||||||
for (; pos < end; ++pos)
|
for (; pos < end; ++pos)
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
ru 262911 69218
|
ru 262914 69218
|
||||||
92101 89421
|
92101 89421
|
||||||
com 63297 30285
|
com 63298 30285
|
||||||
ua 29037 17475
|
ua 29037 17475
|
||||||
html 25077 15037
|
html 25079 15039
|
||||||
tr 16770 11857
|
tr 16770 11857
|
||||||
net 16387 11686
|
net 16387 11686
|
||||||
php 14373 10307
|
php 14374 10307
|
||||||
yandsearch 12024 9484
|
yandsearch 12024 9484
|
||||||
by 8192 6915
|
by 8192 6915
|
||||||
yandex 7211 6124
|
yandex 7211 6124
|
||||||
org 4890 4514
|
org 4890 4514
|
||||||
kz 4677 4209
|
kz 4679 4211
|
||||||
tv 4400 3928
|
tv 4400 3928
|
||||||
su 2602 2396
|
su 2602 2396
|
||||||
phtml 2409 2226
|
phtml 2409 2226
|
||||||
|
Loading…
Reference in New Issue
Block a user