0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::net: Allow explicit port instead of service name for canon string.

This commit is contained in:
Jason Volk 2020-03-06 10:29:23 -08:00
parent 0a90b4d4cc
commit 18ec08c92b

View file

@ -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),
}; };