diff --git a/dbms/src/Functions/URL/domain.h b/dbms/src/Functions/URL/domain.h index edbb629ae95..16c154cde1f 100644 --- a/dbms/src/Functions/URL/domain.h +++ b/dbms/src/Functions/URL/domain.h @@ -32,23 +32,19 @@ inline StringRef getURLHost(const char * data, size_t size) Pos end = data + size; Pos slash_pos = find_first_symbols<'/'>(pos, end); - if (slash_pos != end) - pos = slash_pos; + if (slash_pos < end - 1 && *(slash_pos + 1) == '/') + pos = slash_pos + 2; else pos = data; if (pos != data) { - StringRef scheme = getURLScheme(data, size); + StringRef scheme = getURLScheme(data, end - pos); Pos scheme_end = data + scheme.size; - if (pos - scheme_end != 1 || *scheme_end != ':') + if (scheme.size && (pos - scheme_end != 3 || *scheme_end != ':')) 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; Pos dot_pos = nullptr; for (; pos < end; ++pos) diff --git a/dbms/tests/queries/1_stateful/00038_uniq_state_merge2.reference b/dbms/tests/queries/1_stateful/00038_uniq_state_merge2.reference index 575d19b2ebf..9144afd90b2 100644 --- a/dbms/tests/queries/1_stateful/00038_uniq_state_merge2.reference +++ b/dbms/tests/queries/1_stateful/00038_uniq_state_merge2.reference @@ -1,16 +1,16 @@ -ru 262911 69218 +ru 262914 69218 92101 89421 -com 63297 30285 +com 63298 30285 ua 29037 17475 -html 25077 15037 +html 25079 15039 tr 16770 11857 net 16387 11686 -php 14373 10307 +php 14374 10307 yandsearch 12024 9484 by 8192 6915 yandex 7211 6124 org 4890 4514 -kz 4677 4209 +kz 4679 4211 tv 4400 3928 su 2602 2396 phtml 2409 2226