summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-07-01 10:59:35 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-02 02:56:27 +0200
commit7becb8b80703e510b57ad1e000f3d4e745739d05 (patch)
tree3712530b50e25656bbdbef0ce68d8529c4ade873 /tests
parent96a22ed926cfd706c1b5aca1881f124bc9624f2f (diff)
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) <faure@kde.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp5
1 files changed, 4 insertions, 1 deletions
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)";