mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::net: Allow explicit port instead of service name for canon string.
This commit is contained in:
parent
0a90b4d4cc
commit
18ec08c92b
1 changed files with 3 additions and 4 deletions
|
@ -4453,8 +4453,8 @@ ircd::net::canonize(const mutable_buffer &buf,
|
||||||
{
|
{
|
||||||
thread_local char tlbuf[2][rfc3986::DOMAIN_BUFSIZE * 2];
|
thread_local char tlbuf[2][rfc3986::DOMAIN_BUFSIZE * 2];
|
||||||
|
|
||||||
assert(service(hostport));
|
assert(service(hostport) || port(hostport));
|
||||||
if(unlikely(!service(hostport)))
|
if(unlikely(!service(hostport) && !port(hostport)))
|
||||||
throw error
|
throw error
|
||||||
{
|
{
|
||||||
"Missing service suffix in hostname:service string.",
|
"Missing service suffix in hostname:service string.",
|
||||||
|
@ -4463,9 +4463,8 @@ ircd::net::canonize(const mutable_buffer &buf,
|
||||||
if(port(hostport))
|
if(port(hostport))
|
||||||
return fmt::sprintf
|
return fmt::sprintf
|
||||||
{
|
{
|
||||||
buf, "%s:%s:%u",
|
buf, "%s:%u",
|
||||||
tolower(tlbuf[0], host(hostport)),
|
tolower(tlbuf[0], host(hostport)),
|
||||||
tolower(tlbuf[1], service(hostport)),
|
|
||||||
port(hostport),
|
port(hostport),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue