2022-07-22 07:38:37 +00:00
|
|
|
-- { echo }
|
|
|
|
|
|
|
|
select '-- no-tld';
|
2021-03-21 07:55:28 +00:00
|
|
|
-- no-tld
|
2022-07-22 07:38:37 +00:00
|
|
|
-- even if there is no TLD, 2-nd level by default anyway
|
|
|
|
-- FIXME: make this behavior optional (so that TLD for host never changed, either empty or something real)
|
|
|
|
select cutToFirstSignificantSubdomain('there-is-no-such-domain');
|
2021-03-21 07:55:28 +00:00
|
|
|
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomain('foo.there-is-no-such-domain');
|
2021-03-21 07:55:28 +00:00
|
|
|
foo.there-is-no-such-domain
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomain('bar.foo.there-is-no-such-domain');
|
2021-03-21 07:55:28 +00:00
|
|
|
foo.there-is-no-such-domain
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('there-is-no-such-domain', 'public_suffix_list');
|
2020-12-03 21:11:38 +00:00
|
|
|
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.there-is-no-such-domain', 'public_suffix_list');
|
2020-12-03 21:11:38 +00:00
|
|
|
foo.there-is-no-such-domain
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('bar.foo.there-is-no-such-domain', 'public_suffix_list');
|
2020-12-03 21:11:38 +00:00
|
|
|
foo.there-is-no-such-domain
|
2022-07-22 07:38:37 +00:00
|
|
|
select firstSignificantSubdomainCustom('bar.foo.there-is-no-such-domain', 'public_suffix_list');
|
2020-12-03 21:11:38 +00:00
|
|
|
foo
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- generic';
|
2021-03-21 07:55:28 +00:00
|
|
|
-- generic
|
2022-07-22 07:38:37 +00:00
|
|
|
select firstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel
|
2020-12-03 21:11:38 +00:00
|
|
|
kernel
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel.biz.ss
|
2020-12-03 21:11:38 +00:00
|
|
|
kernel.biz.ss
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- difference';
|
2021-03-21 07:55:28 +00:00
|
|
|
-- difference
|
2022-07-22 07:38:37 +00:00
|
|
|
-- biz.ss is not in the default TLD list, hence:
|
|
|
|
select cutToFirstSignificantSubdomain('foo.kernel.biz.ss'); -- biz.ss
|
2020-12-03 21:11:38 +00:00
|
|
|
biz.ss
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.kernel.biz.ss', 'public_suffix_list'); -- kernel.biz.ss
|
2020-12-03 21:11:38 +00:00
|
|
|
kernel.biz.ss
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- 3+level';
|
2021-03-21 07:55:28 +00:00
|
|
|
-- 3+level
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('xx.blogspot.co.at', 'public_suffix_list'); -- xx.blogspot.co.at
|
2021-03-21 07:55:28 +00:00
|
|
|
xx.blogspot.co.at
|
2022-07-22 07:38:37 +00:00
|
|
|
select firstSignificantSubdomainCustom('xx.blogspot.co.at', 'public_suffix_list'); -- blogspot
|
2021-03-21 07:55:28 +00:00
|
|
|
blogspot
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.bar.xx.blogspot.co.at', 'public_suffix_list'); -- xx.blogspot.co.at
|
2021-03-21 07:55:28 +00:00
|
|
|
xx.blogspot.co.at
|
2022-07-22 07:38:37 +00:00
|
|
|
select firstSignificantSubdomainCustom('foo.bar.xx.blogspot.co.at', 'public_suffix_list'); -- blogspot
|
2021-03-21 07:55:28 +00:00
|
|
|
blogspot
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- url';
|
2021-03-21 07:55:28 +00:00
|
|
|
-- url
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://foobar.com', 'public_suffix_list');
|
2021-03-21 07:55:28 +00:00
|
|
|
foobar.com
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://foobar.com/foo', 'public_suffix_list');
|
2021-03-21 07:55:28 +00:00
|
|
|
foobar.com
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://bar.foobar.com/foo', 'public_suffix_list');
|
2021-03-21 07:55:28 +00:00
|
|
|
foobar.com
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://xx.blogspot.co.at', 'public_suffix_list');
|
2021-03-21 07:55:28 +00:00
|
|
|
xx.blogspot.co.at
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- www';
|
2021-07-06 22:12:56 +00:00
|
|
|
-- www
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustomWithWWW('http://www.foo', 'public_suffix_list');
|
2021-07-06 22:12:56 +00:00
|
|
|
www.foo
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://www.foo', 'public_suffix_list');
|
2021-07-06 22:12:56 +00:00
|
|
|
foo
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- vector';
|
2021-07-06 22:12:56 +00:00
|
|
|
-- vector
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('http://xx.blogspot.co.at/' || toString(number), 'public_suffix_list') from numbers(1);
|
2021-07-06 22:12:56 +00:00
|
|
|
xx.blogspot.co.at
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('there-is-no-such-domain' || toString(number), 'public_suffix_list') from numbers(1);
|
2021-07-06 22:12:56 +00:00
|
|
|
|
2022-07-22 07:38:37 +00:00
|
|
|
select '-- no new line';
|
2021-08-26 21:43:21 +00:00
|
|
|
-- no new line
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.bar', 'no_new_line_list');
|
2021-08-26 21:43:21 +00:00
|
|
|
foo.bar
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('a.foo.bar', 'no_new_line_list');
|
2021-08-26 21:43:21 +00:00
|
|
|
a.foo.bar
|
2022-07-22 07:38:37 +00:00
|
|
|
select cutToFirstSignificantSubdomainCustom('a.foo.baz', 'no_new_line_list');
|
2021-08-26 21:43:21 +00:00
|
|
|
foo.baz
|
2022-07-22 07:36:50 +00:00
|
|
|
select '-- asterisk';
|
|
|
|
-- asterisk
|
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.something.sheffield.sch.uk', 'public_suffix_list');
|
|
|
|
something.sheffield.sch.uk
|
|
|
|
select cutToFirstSignificantSubdomainCustom('something.sheffield.sch.uk', 'public_suffix_list');
|
|
|
|
something.sheffield.sch.uk
|
|
|
|
select cutToFirstSignificantSubdomainCustom('sheffield.sch.uk', 'public_suffix_list');
|
|
|
|
sheffield.sch.uk
|
|
|
|
select '-- exclamation mark';
|
|
|
|
-- exclamation mark
|
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.kawasaki.jp', 'public_suffix_list');
|
|
|
|
foo.kawasaki.jp
|
|
|
|
select cutToFirstSignificantSubdomainCustom('foo.foo.kawasaki.jp', 'public_suffix_list');
|
|
|
|
foo.foo.kawasaki.jp
|
|
|
|
select cutToFirstSignificantSubdomainCustom('city.kawasaki.jp', 'public_suffix_list');
|
|
|
|
city.kawasaki.jp
|
|
|
|
select cutToFirstSignificantSubdomainCustom('some.city.kawasaki.jp', 'public_suffix_list');
|
|
|
|
city.kawasaki.jp
|