diff options
author | Martin Smith <msmith@trolltech.com> | 2010-04-29 11:50:21 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-04-29 11:50:21 (GMT) |
commit | 6b8264f2852712438b8661c7511e9fe6964d5c2f (patch) | |
tree | d34285a7ac5cb143596a0436aa7e5cf80042f587 | |
parent | 04925d40d960a394345f83ef51cce7b547431b92 (diff) | |
parent | 39ee4f868bb0415875413c224f44fd9d7c2a4496 (diff) | |
download | Qt-6b8264f2852712438b8661c7511e9fe6964d5c2f.zip Qt-6b8264f2852712438b8661c7511e9fe6964d5c2f.tar.gz Qt-6b8264f2852712438b8661c7511e9fe6964d5c2f.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
-rw-r--r-- | src/network/access/qnetworkcookiejar.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 8727095..0b3a918 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -269,6 +269,7 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const Q_D(const QNetworkCookieJar); QDateTime now = QDateTime::currentDateTime(); QList<QNetworkCookie> result; + bool isEncrypted = url.scheme().toLower() == QLatin1String("https"); // scan our cookies for something that matches QList<QNetworkCookie>::ConstIterator it = d->allCookies.constBegin(), @@ -280,6 +281,8 @@ QList<QNetworkCookie> QNetworkCookieJar::cookiesForUrl(const QUrl &url) const continue; if (!(*it).isSessionCookie() && (*it).expirationDate() < now) continue; + if ((*it).isSecure() && !isEncrypted) + continue; // insert this cookie into result, sorted by path QList<QNetworkCookie>::Iterator insertIt = result.begin(); diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index f4c4429..01b9c0c 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -304,6 +304,21 @@ void tst_QNetworkCookieJar::cookiesForUrl_data() QTest::newRow("path-match-2") << allCookies << "http://nokia.com/web/" << result; QTest::newRow("path-match-3") << allCookies << "http://nokia.com/web/content" << result; + // secure cookies + allCookies.clear(); + result.clear(); + QNetworkCookie secureCookie; + secureCookie.setName("a"); + secureCookie.setPath("/web"); + secureCookie.setDomain(".nokia.com"); + secureCookie.setSecure(true); + allCookies += secureCookie; + QTest::newRow("no-match-secure-1") << allCookies << "http://nokia.com/web" << result; + QTest::newRow("no-match-secure-2") << allCookies << "http://qt.nokia.com/web" << result; + result += secureCookie; + QTest::newRow("match-secure-1") << allCookies << "https://nokia.com/web" << result; + QTest::newRow("match-secure-2") << allCookies << "https://qt.nokia.com/web" << result; + } void tst_QNetworkCookieJar::cookiesForUrl() |