From 2ed281472f20cd01043351e8debb44bab30fcf0b Mon Sep 17 00:00:00 2001 From: Vort Date: Wed, 1 Feb 2023 00:25:41 +0200 Subject: [PATCH] enclose IPv6 address in square brackets --- daemon/HTTPServer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 0b99c047..d9daeb5e 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -329,14 +329,15 @@ namespace http { default: s << tr("Unknown"); } - if (address->IsV6 ()) + bool v6 = address->IsV6 (); + if (v6) { if (address->IsV4 ()) s << "v4"; s << "v6"; } s << "\r\n"; if (address->published) - s << "" << address->host.to_string() << ":" << address->port << "\r\n"; + s << "" << (v6 ? "[" : "") << address->host.to_string() << (v6 ? "]:" : ":") << address->port << "\r\n"; else { s << "" << tr(/* tr: Shown when router doesn't publish itself and have "Firewalled" state */ "supported");