From d20ea5265f2bdb1ae44347c2ab0da9411c5a6714 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Dec 2020 15:26:41 +0200 Subject: [PATCH] MXS-3326 Add test that reveals problem A hyphen '-' is a valid character in a domain name, as long as it is not the first character and does not appear two in a row. --- maxutils/maxbase/src/test/test_host_class.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maxutils/maxbase/src/test/test_host_class.cc b/maxutils/maxbase/src/test/test_host_class.cc index 1916558e9..379059046 100644 --- a/maxutils/maxbase/src/test/test_host_class.cc +++ b/maxutils/maxbase/src/test/test_host_class.cc @@ -88,6 +88,7 @@ try test("[fe80::37f8:99a2:558a:9f5d]:4001", maxbase::Host::Type::IPV6); test("[::]:4001", maxbase::Host::Type::IPV6); test("google.com:80", maxbase::Host::Type::HostName); + test("hello-world.fi:3333", maxbase::Host::Type::HostName); std::cout << "The following should be INVALID!!!!!\n"; test("/tmp/socket/", maxbase::Host::Type::Invalid); @@ -96,6 +97,8 @@ try test("[127.0.0.1]:", maxbase::Host::Type::Invalid); test("[127.0.0.1:", maxbase::Host::Type::Invalid); test("_hello_world.fi:3333", maxbase::Host::Type::Invalid); + test("-hello_world.fi:3333", maxbase::Host::Type::Invalid); + test("hello--world.fi:3333", maxbase::Host::Type::Invalid); std::cout << "\nRegular Constructor!!!!!\n";