libstdc++: Use "test.invalid." for invalid hostname

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.
This commit is contained in:
Jonathan Wakely 2021-09-10 15:08:27 +01:00
parent 79f488de30
commit 7f8af6dc82

View File

@ -97,7 +97,7 @@ test03()
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() );
@ -105,7 +105,7 @@ test03()
#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 );