summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp20
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp8
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 76e5c580a8..29b88980ad 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -3059,6 +3059,26 @@ void tst_QUrl::setComponents_data()
QTest::newRow("fragment-encode") << QUrl("http://example.com/foo#z")
<< int(Fragment) << "bar%23" << Decoded << true
<< PrettyDecoded << "bar%2523" << "http://example.com/foo#bar%2523";
+ // force decoding; note how the userinfo becomes ambiguous
+ QTest::newRow("userinfo-decode") << QUrl("http://example.com")
+ << int(UserInfo) << "hello%3Aworld:}}>b9o%25kR(" << Tolerant << true
+ << FullyDecoded << "hello:world:}}>b9o%kR("
+ << "http://hello%3Aworld:%7D%7D%3Eb9o%25kR(@example.com";
+ QTest::newRow("username-decode") << QUrl("http://example.com")
+ << int(UserName) << "hello%3Aworld%25" << Tolerant << true
+ << FullyDecoded << "hello:world%" << "http://hello%3Aworld%25@example.com";
+ QTest::newRow("password-decode") << QUrl("http://example.com")
+ << int(Password) << "}}>b9o%25kR(" << Tolerant << true
+ << FullyDecoded << "}}>b9o%kR(" << "http://:%7D%7D%3Eb9o%25kR(@example.com";
+ QTest::newRow("path-decode") << QUrl("http://example.com/")
+ << int(Path) << "/bar%25foo" << Tolerant << true
+ << FullyDecoded << "/bar%foo" << "http://example.com/bar%25foo";
+ QTest::newRow("query-decode") << QUrl("http://example.com/foo?qq")
+ << int(Query) << "bar%25foo" << Tolerant << true
+ << FullyDecoded << "bar%foo" << "http://example.com/foo?bar%25foo";
+ QTest::newRow("fragment-decode") << QUrl("http://example.com/foo#qq")
+ << int(Fragment) << "bar%25foo" << Tolerant << true
+ << FullyDecoded << "bar%foo" << "http://example.com/foo#bar%25foo";
}
void tst_QUrl::setComponents()
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 68aaa198a8..67e43028d4 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -886,6 +886,14 @@ void tst_QUrlInternal::encodingRecode_data()
QTest::newRow("control-unreserved-0x" + code) << "Foo%00Bar%0D%0Abksp%7F" << mode << "Foo%00Bar%0D%0Abksp%7F";
}
+ // however, control characters and the percent *are* decoded in FullyDecoded mode
+ // this is the only exception
+ QTest::newRow("control-nul-fullydecoded") << "%00" << F(QUrl::FullyDecoded) << QStringLiteral("\0");
+ QTest::newRow("control-fullydecoded") << "%0D%0A%1F%1A%7F" << F(QUrl::FullyDecoded) << "\r\n\x1f\x1a\x7f";
+ QTest::newRow("percent-fullydecoded") << "25%2525" << F(QUrl::FullyDecoded) << "25%25";
+ QTest::newRow("control-unreserved-fullydecoded") << "Foo%00Bar%0D%0Abksp%7F" << F(QUrl::FullyDecoded)
+ << QStringLiteral("Foo\0Bar\r\nbksp\x7F");
+
// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
// / "*" / "+" / "," / ";" / "="