From 7becb8b80703e510b57ad1e000f3d4e745739d05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Jul 2013 10:59:35 -0700 Subject: QUrl test: ensure that hostnames with bad non-IDN domains are caught too Leading and double dots are bad, but trailing dots are fine. The ASCII part of a hostname is supposed to be LDH (letters, digits, hyphen) only, but we accept '_' (underscore) as an exception too. Change-Id: I79957ddec4da78a0e2357fe50c8687db03e1c99e Reviewed-by: David Faure (KDE) --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 2a79a6963e..2a506ef8e2 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1937,7 +1937,10 @@ void tst_QUrl::strictParser_data() QTest::newRow("invalid-ipvfuture-3") << "http://[v789]" << "Invalid IPvFuture address"; QTest::newRow("unbalanced-brackets") << "http://[ff02::1" << "Expected ']' to match '[' in hostname"; - // invalid IDN hostnames happen in TolerantMode too + // invalid hostnames happen in TolerantMode too + QTest::newRow("invalid-hostname-leading-dot") << "http://.co.uk" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("invalid-hostname-double-dot") << "http://co..uk" << "Invalid hostname (contains invalid characters)"; + QTest::newRow("invalid-hostname-non-LDH") << "http://foo,bar.example.com" << "Invalid hostname (contains invalid characters)"; QTest::newRow("idn-prohibited-char-space") << "http:// " << "Invalid hostname (contains invalid characters)"; QTest::newRow("idn-prohibited-char-nbsp") << "http://\xc2\xa0" << "Invalid hostname (contains invalid characters)"; QTest::newRow("idn-prohibited-char-control-1f") << "http://\x1f" << "Invalid hostname (contains invalid characters)"; -- cgit v1.2.3