2022-10-25 17:18:32 +00:00
|
|
|
{% for suffix in ['', 'RFC'] -%}
|
|
|
|
|
|
|
|
select 'ipv4';
|
|
|
|
select port{{ suffix }}('http://127.0.0.1/');
|
|
|
|
select port{{ suffix }}('http://127.0.0.1:80');
|
|
|
|
select port{{ suffix }}('http://127.0.0.1:80/');
|
|
|
|
select port{{ suffix }}('//127.0.0.1:80/');
|
|
|
|
select port{{ suffix }}('127.0.0.1:80');
|
|
|
|
|
|
|
|
select 'hostname';
|
|
|
|
select port{{ suffix }}('http://foobar.com/');
|
|
|
|
select port{{ suffix }}('http://foobar.com:80');
|
|
|
|
select port{{ suffix }}('http://foobar.com:80/');
|
|
|
|
select port{{ suffix }}('//foobar.com:80/');
|
|
|
|
select port{{ suffix }}('foobar.com:80');
|
|
|
|
|
|
|
|
select 'default-port';
|
|
|
|
select port{{ suffix }}('http://127.0.0.1/', toUInt16(80));
|
|
|
|
select port{{ suffix }}('http://foobar.com/', toUInt16(80));
|
|
|
|
|
|
|
|
-- unsupported
|
2023-03-03 14:13:07 +00:00
|
|
|
/* ILLEGAL_TYPE_OF_ARGUMENT */ select port(toFixedString('', 1)); -- { serverError 43 }
|
|
|
|
/* ILLEGAL_TYPE_OF_ARGUMENT */ select port{{ suffix }}('', 1); -- { serverError 43 }
|
|
|
|
/* NUMBER_OF_ARGUMENTS_DOESNT_MATCH */ select port{{ suffix }}('', 1, 1); -- { serverError 42 }
|
2022-10-25 17:18:32 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Known limitations of domain() (getURLHost())
|
|
|
|
--
|
|
|
|
select 'ipv6';
|
|
|
|
select port{{ suffix }}('http://[2001:db8::8a2e:370:7334]/');
|
|
|
|
select port{{ suffix }}('http://[2001:db8::8a2e:370:7334]:80');
|
|
|
|
select port{{ suffix }}('http://[2001:db8::8a2e:370:7334]:80/');
|
|
|
|
select port{{ suffix }}('//[2001:db8::8a2e:370:7334]:80/');
|
|
|
|
select port{{ suffix }}('[2001:db8::8a2e:370:7334]:80');
|
|
|
|
select port{{ suffix }}('2001:db8::8a2e:370:7334:80');
|
|
|
|
select 'host-no-dot';
|
|
|
|
select port{{ suffix }}('//foobar:80/');
|
|
|
|
|
|
|
|
{%- endfor %}
|