diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-04-23 22:43:18 -0300 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-05-04 21:18:01 +0000 |
commit | 74412088d5b0d2ac3f1ad56a46cdffb206311c5f (patch) | |
tree | ff948de4621d693a00b03f9a57c1be364ce788dd /tests | |
parent | 43493ff5cf96c4528d12541531983fc21b55a3d2 (diff) |
QUrl: fix IDN whitelist checking when the TLD is in Unicode
The whitelist is kept in ACE form, so if the TLD came in Unicode, we
need to run ToASCII before we can check the whitelist. This is slightly
inefficient because we'll run the same operation later in this domain.
Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
(cherry picked from commit 21dd5d314a75c09250448e5d59dfb9af88c0f7d5)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index 753a679d4c..8c9627b220 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -675,6 +675,14 @@ void tst_QUrlInternal::ace_testsuite() QCOMPARE(QUrl::fromAce(domain.toLatin1()), fromace + suffix); QCOMPARE(QUrl::fromAce(QUrl::toAce(domain)), unicode + suffix); + QUrl u; + u.setHost(domain); + QVERIFY(u.isValid()); + QCOMPARE(u.host(), unicode + suffix); + QCOMPARE(u.host(QUrl::EncodeUnicode), toace + suffix); + QCOMPARE(u.toEncoded(), "//" + toace.toLatin1() + suffix); + QCOMPARE(u.toDisplayString(), "//" + unicode + suffix); + domain = in + (suffix ? ".troll.No" : ""); QCOMPARE(QString::fromLatin1(QUrl::toAce(domain)), toace + suffix); if (fromace != ".") |