diff options
| author | Liang Qi <liang.qi@qt.io> | 2019-07-26 10:13:06 +0200 |
|---|---|---|
| committer | Liang Qi <liang.qi@qt.io> | 2019-07-26 13:29:27 +0200 |
| commit | 28af6e97e5fe7f844bc85df7af22ce8b7414f5a6 (patch) | |
| tree | ed83933e4f6a9d40c546c85aa136f18ce927dfc8 /src/network/access/qhttp2protocolhandler.cpp | |
| parent | 547f216efdef3667b0b23ecddce93e5184806800 (diff) | |
| parent | bf08e0bbb28917f1965cd29ed449e553d1d1f4f1 (diff) | |
Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"
Diffstat (limited to 'src/network/access/qhttp2protocolhandler.cpp')
| -rw-r--r-- | src/network/access/qhttp2protocolhandler.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 87a70d8a557..5d7fc7506ec 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -170,7 +170,6 @@ QHttp2ProtocolHandler::QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *chan encoder(HPack::FieldLookupTable::DefaultSize, true) { Q_ASSERT(channel && m_connection); - continuedFrames.reserve(20); const ProtocolParameters params(m_connection->http2Parameters()); @@ -322,10 +321,32 @@ bool QHttp2ProtocolHandler::sendRequest() return false; } + // Process 'fake' (created by QNetworkAccessManager::connectToHostEncrypted()) + // requests first: + auto &requests = m_channel->spdyRequestsToSend; + for (auto it = requests.begin(), endIt = requests.end(); it != endIt;) { + const auto &pair = *it; + const QString scheme(pair.first.url().scheme()); + if (scheme == QLatin1String("preconnect-http") + || scheme == QLatin1String("preconnect-https")) { + m_connection->preConnectFinished(); + emit pair.second->finished(); + it = requests.erase(it); + if (!requests.size()) { + // Normally, after a connection was established and H2 + // was negotiated, we send a client preface. connectToHostEncrypted + // though is not meant to send any data, it's just a 'preconnect'. + // Thus we return early: + return true; + } + } else { + ++it; + } + } + if (!prefaceSent && !sendClientPreface()) return false; - auto &requests = m_channel->spdyRequestsToSend; if (!requests.size()) return true; |
