From 6cee284001adf9da42b347a074cbff3cb92621b2 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 10 Sep 2019 16:39:43 +0200 Subject: Fix mis-handling of actual TLD in qIsEffectiveTLD() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the domain passed down is an actual TLD that's the subject of a * rule, e.g. "ck" subject to *.ck, then we were finding no dot in it and concluding that it couldn't be the subject of a * rule. Added a test for the specific .ck case and commented on where we could get some canonical test data that I tripped over while researching this. Cross-reference the cookie-jar test from the QUrl test, too. Fixes: QTBUG-78097 Change-Id: Id858a9dae22e6b306a68df3fc199e0160f537159 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Thiago Macieira --- src/corelib/io/qtldurl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/io') diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp index 912609ec91..fc3e16b241 100644 --- a/src/corelib/io/qtldurl.cpp +++ b/src/corelib/io/qtldurl.cpp @@ -125,10 +125,10 @@ Q_CORE_EXPORT bool qIsEffectiveTLD(const QStringRef &domain) return true; const int dot = domain.indexOf(QLatin1Char('.')); - if (dot >= 0) { - if (containsTLDEntry(domain.mid(dot), SuffixMatch)) // 2 - return !containsTLDEntry(domain, ExceptionMatch); // 3 - } + if (dot < 0) // Actual TLD: may be effective if the subject of a wildcard rule: + return containsTLDEntry(QString(QLatin1Char('.') + domain), SuffixMatch); + if (containsTLDEntry(domain.mid(dot), SuffixMatch)) // 2 + return !containsTLDEntry(domain, ExceptionMatch); // 3 return false; } -- cgit v1.2.3