summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--tests/auto/qurl/tst_qurl.cpp22
2 files changed, 23 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index ba1110d..076cc33 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3242,7 +3242,7 @@ static QString qt_ACE_do(const QString &domain, AceOperation op)
int idx = nextDotDelimiter(domain, lastIdx);
int labelLength = idx - lastIdx;
if (labelLength == 0) {
- if (idx == domain.length() && idx > 0)
+ if (idx == domain.length())
break;
return QString(); // two delimiters in a row -- empty label not allowed
}
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 33812fe..f108f4c 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -165,6 +165,8 @@ private slots:
void ace_testsuite();
void std3violations_data();
void std3violations();
+ void std3deviations_data();
+ void std3deviations();
void tldRestrictions_data();
void tldRestrictions();
void emptyQueryOrFragment();
@@ -3238,6 +3240,8 @@ void tst_QUrl::std3violations_data()
QTest::newRow("bang") << "foo!" << false;
QTest::newRow("plus") << "foo+bar" << false;
QTest::newRow("dot") << "foo.bar";
+ QTest::newRow("startingdot") << ".bar" << false;
+ QTest::newRow("startingdot2") << ".example.com" << false;
QTest::newRow("slash") << "foo/bar" << true;
QTest::newRow("colon") << "foo:80" << true;
QTest::newRow("question") << "foo?bar" << true;
@@ -3282,6 +3286,24 @@ void tst_QUrl::std3violations()
QVERIFY(!url.isValid());
}
+void tst_QUrl::std3deviations_data()
+{
+ QTest::addColumn<QString>("source");
+
+ QTest::newRow("ending-dot") << "example.com.";
+ QTest::newRow("ending-dot3002") << QString("example.com") + QChar(0x3002);
+}
+
+void tst_QUrl::std3deviations()
+{
+ QFETCH(QString, source);
+ QVERIFY(!QUrl::toAce(source).isEmpty());
+
+ QUrl url;
+ url.setHost(source);
+ QVERIFY(!url.host().isEmpty());
+}
+
void tst_QUrl::tldRestrictions_data()
{
QTest::addColumn<QString>("tld");