mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
ISSUES-995 fix cut www
This commit is contained in:
parent
3f8c42c97d
commit
219de205e3
@ -396,20 +396,41 @@ struct ExtractWWW
|
||||
Pos pos = data;
|
||||
Pos end = pos + size;
|
||||
|
||||
if (nullptr != (pos = strchr(pos, '/')))
|
||||
{
|
||||
if (pos != data)
|
||||
{
|
||||
Pos tmp;
|
||||
size_t protocol_length;
|
||||
ExtractProtocol::execute(data, size, tmp, protocol_length);
|
||||
pos += protocol_length + 3;
|
||||
|
||||
if (pos >= end || pos[-1] != '/' || pos[-2] != '/')
|
||||
if (pos != data + protocol_length + 1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (end - pos < 2 || *(pos++) != '/' || *(pos++) != '/')
|
||||
return;
|
||||
|
||||
if (pos + 4 < end && !strncmp(pos, "www.", 4))
|
||||
const char *st = pos;
|
||||
for (; pos < end; ++pos)
|
||||
{
|
||||
res_data = pos;
|
||||
if (*pos == '@')
|
||||
{
|
||||
st = pos + 1;
|
||||
} else if (*pos == ':' || *pos == '/' || *pos == '?' || *pos == '#')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (st + 4 < end && !strncmp(st, "www.", 4))
|
||||
{
|
||||
res_data = st;
|
||||
res_size = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user