diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-06-22 11:38:32 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-06-22 11:38:32 (GMT) |
commit | 14f10211e72f2d04fa7f4e0faa430eb94c1f8f83 (patch) | |
tree | 1e8d1e2f758c1090a15123cbcb8f615d867caa47 /src/network/access | |
parent | e4cce8849bf45be9a111072e3fca7bdf67364e8a (diff) | |
parent | 5e80b137d195625c0d57c1c27e5e8464d1ccfa33 (diff) | |
download | Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.zip Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.tar.gz Qt-14f10211e72f2d04fa7f4e0faa430eb94c1f8f83.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/opengl/qgl.cpp
src/opengl/qpixmapdata_symbiangl.cpp
src/opengl/qwindowsurface_gl.cpp
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qnetworkcookiejar.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index a2fa689..1a5f73b 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -220,20 +220,33 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieLis continue; // not accepted } - QList<QNetworkCookie>::Iterator it = d->allCookies.begin(), - end = d->allCookies.end(); - for ( ; it != end; ++it) + for (int i = 0; i < d->allCookies.size(); ++i) { // does this cookie already exist? - if (cookie.name() == it->name() && - cookie.domain() == it->domain() && - cookie.path() == it->path()) { + const QNetworkCookie ¤t = d->allCookies.at(i); + if (cookie.name() == current.name() && + cookie.domain() == current.domain() && + cookie.path() == current.path()) { // found a match - d->allCookies.erase(it); + d->allCookies.removeAt(i); break; } + } // did not find a match if (!isDeletion) { + int countForDomain = 0; + for (int i = d->allCookies.size() - 1; i >= 0; --i) { + // Start from the end and delete the oldest cookies to keep a maximum count of 50. + const QNetworkCookie ¤t = d->allCookies.at(i); + if (isParentDomain(cookie.domain(), current.domain()) + || isParentDomain(current.domain(), cookie.domain())) { + if (countForDomain >= 49) + d->allCookies.removeAt(i); + else + ++countForDomain; + } + } + d->allCookies += cookie; ++added; } |