1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Fixed cookie filtering, some cookies have empty domain().

This commit is contained in:
nowrep 2012-02-20 17:22:31 +01:00
parent f82eda3bae
commit 88de940dc1

View File

@ -23,6 +23,11 @@
bool containsDomain(QString string, QString domain) bool containsDomain(QString string, QString domain)
{ {
if (string.isEmpty()) {
// Some cookies have empty domain() ... bug?
return true;
}
string.prepend("."); string.prepend(".");
if (domain.startsWith("www.")) { if (domain.startsWith("www.")) {
domain = domain.mid(4); domain = domain.mid(4);
@ -89,9 +94,9 @@ bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const
continue; continue;
} }
if (m_allowCookiesFromDomain && !containsDomain(cookie.domain(), url.host())) { if (m_allowCookiesFromDomain && !containsDomain(url.host(), cookie.domain())) {
#ifdef COOKIE_DEBUG #ifdef COOKIE_DEBUG
qDebug() << "purged for domain mismatch" << cookie; qDebug() << "purged for domain mismatch" << cookie << cookie.domain() << url.host();
#endif #endif
newList.removeOne(cookie); newList.removeOne(cookie);
continue; continue;