diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-07-01 16:58:21 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-20 05:06:11 +0200 |
commit | 393865be2a68d61200808c0a6d8e7957139ab9d5 (patch) | |
tree | ca6f9af6f984f3a6e7fa247d9f9d82fdad172d0d /tests/auto/corelib/io/qurl/tst_qurl.cpp | |
parent | afe66eb9b4a9d4352409d8342495e2e6713bfb9f (diff) |
Fix QUrl parsing of IPv6 hosts with encoded colons
Registered names and IP addresses can only contain unreserved
characters (letters, digits, dots, hyphens, underscores) and the
colon, which is a gen-delim. For registered names and IPv4 addresses,
we can simply use the default config -- if anything that remains
percent-encoded, it means it's not a valid hostname anyway.
For IPv6, we just need to decode the colon.
Change-Id: If8083d47f6e5375f760e7a6c59631c89e4da8378
Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'tests/auto/corelib/io/qurl/tst_qurl.cpp')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index c06aad38ff..cda187b037 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -1656,6 +1656,9 @@ void tst_QUrl::ipv6_data() QTest::newRow("case :,") << QString::fromLatin1("//[:,]") << false << ""; QTest::newRow("case ::bla") << QString::fromLatin1("//[::bla]") << false << ""; QTest::newRow("case v4-mapped") << "//[0:0:0:0:0:ffff:7f00:1]" << true << "//[::ffff:127.0.0.1]"; + + QTest::newRow("encoded-digit") << "//[::%31]" << true << "//[::1]"; + QTest::newRow("encoded-colon") << "//[%3A%3A]" << true << "//[::]"; } void tst_QUrl::ipv6() @@ -1950,6 +1953,7 @@ void tst_QUrl::strictParser_data() QTest::newRow("invalid-ipvfuture-1") << "http://[v7]" << "Invalid IPvFuture address"; QTest::newRow("invalid-ipvfuture-2") << "http://[v7.]" << "Invalid IPvFuture address"; QTest::newRow("invalid-ipvfuture-3") << "http://[v789]" << "Invalid IPvFuture address"; + QTest::newRow("invalid-encoded-ipv6") << "x://[%3a%3a%31]" << "Invalid IPv6 address"; QTest::newRow("unbalanced-brackets") << "http://[ff02::1" << "Expected ']' to match '[' in hostname"; // invalid hostnames happen in TolerantMode too |