diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-06-20 11:37:37 (GMT) |
---|---|---|
committer | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2011-06-20 11:37:37 (GMT) |
commit | f332786abc6817fefaa683fb22caa40184c1316e (patch) | |
tree | f604af4c61007eee49d39d715b300c3622c52753 /src/network | |
parent | 9a3f592966b9227f099e752f578a157500989146 (diff) | |
parent | 61aae4e9a033bfb59664105e5377fd086bacb517 (diff) | |
download | Qt-f332786abc6817fefaa683fb22caa40184c1316e.zip Qt-f332786abc6817fefaa683fb22caa40184c1316e.tar.gz Qt-f332786abc6817fefaa683fb22caa40184c1316e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 12 | ||||
-rw-r--r-- | src/network/access/qnetworkcookiejar.cpp | 27 |
2 files changed, 31 insertions, 8 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 61230fc..d76a5fd 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -256,7 +256,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 291bdec..e49a8e1 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; } |