diff options
author | Liang Qi <liang.qi@qt.io> | 2016-10-13 09:49:38 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-10-13 09:49:38 +0200 |
commit | dfc177e3a99dd593db4b1e9445d6243ce75ebf07 (patch) | |
tree | 4e33c7be90a44642e672fff22ea163b500ff3aef /src/network/access | |
parent | 72efb2e6f4af2fd909daaf9104f09fd1425acfb0 (diff) | |
parent | 1d6eb70dcec105af28d6a5e9b59d56c895c70389 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
qmake/library/qmakeevaluator.cpp
(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
src/corelib/kernel/qcore_mac_objc.mm
src/gui/painting/qcolor.h
src/plugins/platforms/cocoa/qcocoawindow.mm
Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 15 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnection_p.h | 1 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 3 | ||||
-rw-r--r-- | src/network/access/qnetworkcookiejar.cpp | 11 |
4 files changed, 23 insertions, 7 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 8e5cfd9497..6f837de27f 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -674,8 +674,7 @@ bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket) HttpMessagePair messagePair = highPriorityQueue.takeLast(); if (!messagePair.second->d_func()->requestIsPrepared) prepareRequest(messagePair); - channels[i].request = messagePair.first; - channels[i].reply = messagePair.second; + updateChannel(i, messagePair); return true; } @@ -684,13 +683,21 @@ bool QHttpNetworkConnectionPrivate::dequeueRequest(QAbstractSocket *socket) HttpMessagePair messagePair = lowPriorityQueue.takeLast(); if (!messagePair.second->d_func()->requestIsPrepared) prepareRequest(messagePair); - channels[i].request = messagePair.first; - channels[i].reply = messagePair.second; + updateChannel(i, messagePair); return true; } return false; } +void QHttpNetworkConnectionPrivate::updateChannel(int i, const HttpMessagePair &messagePair) +{ + channels[i].request = messagePair.first; + channels[i].reply = messagePair.second; + // Now that reply is assigned a channel, correct reply to channel association + // previously set in queueRequest. + channels[i].reply->d_func()->connectionChannel = &channels[i]; +} + QHttpNetworkRequest QHttpNetworkConnectionPrivate::predictNextRequest() const { if (!highPriorityQueue.isEmpty()) diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h index cad0ab1ac4..430c715717 100644 --- a/src/network/access/qhttpnetworkconnection_p.h +++ b/src/network/access/qhttpnetworkconnection_p.h @@ -210,6 +210,7 @@ public: void requeueRequest(const HttpMessagePair &pair); // e.g. after pipeline broke bool dequeueRequest(QAbstractSocket *socket); void prepareRequest(HttpMessagePair &request); + void updateChannel(int i, const HttpMessagePair &messagePair); QHttpNetworkRequest predictNextRequest() const; void fillPipeline(QAbstractSocket *socket); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index b6a9b80511..205490b830 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -1111,6 +1111,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted() connection->d_func()->dequeueRequest(socket); if (reply) { reply->setSpdyWasUsed(false); + Q_ASSERT(reply->d_func()->connectionChannel == this); emit reply->encrypted(); } if (reply) @@ -1137,8 +1138,6 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors) connection->d_func()->pauseConnection(); if (pendingEncrypt && !reply) connection->d_func()->dequeueRequest(socket); - if (reply) // a reply was actually dequeued. - reply->d_func()->connectionChannel = this; // set correct channel like in sendRequest() and queueRequest(); if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP) { if (reply) emit reply->sslErrors(errors); diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 429b71eb21..0540cb740f 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -335,11 +335,20 @@ bool QNetworkCookieJar::validateCookie(const QNetworkCookie &cookie, const QUrl if (!isParentDomain(domain, host) && !isParentDomain(host, domain)) return false; // not accepted + if (domain.startsWith(QLatin1Char('.'))) + domain = domain.mid(1); + +#if QT_CONFIG(topleveldomain) // the check for effective TLDs makes the "embedded dot" rule from RFC 2109 section 4.3.2 // redundant; the "leading dot" rule has been relaxed anyway, see QNetworkCookie::normalize() // we remove the leading dot for this check if it's present - if (qIsEffectiveTLD(domain.startsWith('.') ? domain.remove(0, 1) : domain)) + if (qIsEffectiveTLD(domain)) return false; // not accepted +#else + // provide minimal checking by not accepting cookies on real TLDs + if (!domain.contains(QLatin1Char('.'))) + return false; +#endif return true; } |