summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-06-07 19:22:28 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-08 15:20:44 +0200
commit9095210c0b57f75fe2fecf7289fabbdfdf64e198 (patch)
treeaa5642987e90e17075f212fbe3c19c8cebe4f194 /tests
parent9e65808acfc82354188a67f23304f1c09074136c (diff)
tst_QUrl: check that prohibited characters in hostnames are not valid
qt_nameprep is tested by tst_qurlinternal. We just need to be sure that QUrl handles them correctly. Change-Id: Ic563004870d2cf2fa7a31ce49fff7280d5ffb5f3 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 898aefffd3..2a79a6963e 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1937,6 +1937,21 @@ 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
+ 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)";
+ QTest::newRow("idn-prohibited-char-control-7f") << "http://\x7f" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-control-80") << "http://\xc2\x80" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-private-bmp") << "http://\xee\x80\x80" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-private-plane15") << "http://\xf3\xb0\x80\x80" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-private-plane16") << "http://\xf4\x80\x80\x80" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-ffff") << "http://\xef\xbf\xbf" << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-surrogate-1") << "http://" + QString(QChar(0xD800)) << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-surrogate-2") << "http://" + QString(QChar(0xDC00)) << "Invalid hostname (contains invalid characters)";
+ QTest::newRow("idn-prohibited-char-surrogate-3") << "http://" + QString(QChar(0xD800)) + "a" << "Invalid hostname (contains invalid characters)";
+ // FIXME: add some tests for prohibited BiDi (RFC 3454 section 6)
+
// port errors happen in TolerantMode too
QTest::newRow("empty-port-1") << "http://example.com:" << "Port field was empty";
QTest::newRow("empty-port-2") << "http://example.com:/" << "Port field was empty";