This avoids test.invalid.some.domain being successfully resolved.
libstdc++-v3/ChangeLog:
* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Fix invalid hostname to only match the .invalid TLD.
std::error_code ec;
io_context ctx;
ip::tcp::resolver resolv(ctx);
- auto addrs = resolv.resolve("test.invalid", "http", ec);
+ auto addrs = resolv.resolve("test.invalid.", "http", ec);
VERIFY( ec );
VERIFY( addrs.size() == 0 );
VERIFY( addrs.begin() == addrs.end() );
#if __cpp_exceptions
bool caught = false;
try {
- resolv.resolve("test.invalid", "http");
+ resolv.resolve("test.invalid.", "http");
} catch (const std::system_error& e) {
caught = true;
VERIFY( e.code() == ec );