summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-03-18 19:57:48 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-06-26 12:59:40 (GMT)
commit8e9a6aca959336ef150021a858178fc3cd1ad426 (patch)
tree7a6672f36d8cb1587cd5f41ed7fe15cfb9d2ae23 /tests/auto
parent043465a5902e95decde01cf4a50ecd59472b9ecd (diff)
downloadQt-8e9a6aca959336ef150021a858178fc3cd1ad426.zip
Qt-8e9a6aca959336ef150021a858178fc3cd1ad426.tar.gz
Qt-8e9a6aca959336ef150021a858178fc3cd1ad426.tar.bz2
Autotest: remove or correct invalid tests
In making QUrl more strict with hostnames (to avoid malicious attacks), I'm implementing the STD3 checks described by RFC 3490. These tests are invalid, so they are being removed or corrected. STD3 requires that the hostname be composed of Letters, Digits, Hyphens (so no underlines) and limited to 63 characters. Also, an empty port doesn't make sense.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qurl/tst_qurl.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 47c86cc..ea551da 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -608,18 +608,6 @@ void tst_QUrl::setUrl()
}
{
- QString bigStr(QLatin1String("abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXYZ"));
- QUrl url;
- url.setHost(bigStr);
- QVERIFY(url.isValid());
- QCOMPARE(url.host().toLower(), bigStr.toLower());
- }
-
- {
QUrl url;
url.setUrl("hello.com#?");
QVERIFY(url.isValid());
@@ -1398,8 +1386,6 @@ void tst_QUrl::i18n_data()
QTest::newRow("øl") << QString::fromLatin1("http://ole:passord@www.øl.no/index.html?ole=æsemann&ilder gud=hei#top")
<< QByteArray("http://ole:passord@www.xn--l-4ga.no/index.html?ole=%C3%A6semann&ilder%20gud=hei#top");
- QTest::newRow("øl") << QString::fromLatin1("http://ole:passord@www.øl.no/index.html?ole=æsemann&ilder gud=hei#top")
- << QByteArray("http://ole:passord@www.xn--l-4ga.no/index.html?ole=%C3%A6semann&ilder%20gud=hei#top");
QTest::newRow("räksmörgås") << QString::fromLatin1("http://www.räksmörgås.no/")
<< QByteArray("http://www.xn--rksmrgs-5wao1o.no/");
QTest::newRow("bühler") << QString::fromLatin1("http://www.bühler.no/")
@@ -2423,19 +2409,18 @@ void tst_QUrl::isValid()
QCOMPARE(url.path(), QString("A=B"));
}
{
- QUrl url = QUrl::fromEncoded("http://strange<username>@ok_hostname/", QUrl::StrictMode);
+ QUrl url = QUrl::fromEncoded("http://strange<username>@ok-hostname/", QUrl::StrictMode);
QVERIFY(!url.isValid());
// < and > are not allowed in userinfo in strict mode
}
{
- QUrl url = QUrl::fromEncoded("http://strange<username>@ok_hostname/");
+ QUrl url = QUrl::fromEncoded("http://strange<username>@ok-hostname/");
QVERIFY(url.isValid());
// < and > are allowed in tolerant mode
}
{
QUrl url = QUrl::fromEncoded("http://strange;hostname/here");
- QVERIFY(url.isValid());
- QCOMPARE(url.host(), QString("strange;hostname"));
+ QVERIFY(!url.isValid());
QCOMPARE(url.path(), QString("/here"));
}
}
@@ -3486,7 +3471,6 @@ void tst_QUrl::setAuthority_data()
QTest::addColumn<QString>("authority");
QTest::addColumn<QString>("url");
QTest::newRow("Plain auth") << QString("62.70.27.22:21") << QString("//62.70.27.22:21");
- QTest::newRow("Auth with empty port") << QString("62.70.27.22:") << QString("//62.70.27.22:");
QTest::newRow("Yet another plain auth") << QString("192.168.1.1:21") << QString("//192.168.1.1:21");
QTest::newRow("Auth without port") << QString("192.168.1.1") << QString("//192.168.1.1");
QTest::newRow("Auth w/full hostname without port") << QString("shusaku.troll.no") << QString("//shusaku.troll.no");
@@ -3494,7 +3478,6 @@ void tst_QUrl::setAuthority_data()
QTest::newRow("Auth w/full hostname that ends with number, without port") << QString("shusaku.troll.no.2") << QString("//shusaku.troll.no.2");
QTest::newRow("Auth w/hostname that ends with number, without port") << QString("shusaku2") << QString("//shusaku2");
QTest::newRow("Empty auth") << QString() << QString();
- QTest::newRow("Single") << QString(":") << QString("//:");
}
void tst_QUrl::setAuthority()