diff options
| author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-08 11:33:28 +0200 |
|---|---|---|
| committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-08 11:33:39 +0200 |
| commit | 72a04b132c346a61e0a46f39df977e56306fc84c (patch) | |
| tree | 918d3c9f20432204452ceab997e8c49dc2604319 /src/network/access/qhttp2protocolhandler.cpp | |
| parent | cc32a691936f37eaaec618a71edd62f896009c9d (diff) | |
| parent | 1f35c8caa02eb9d27b87188f2fa21473ea694948 (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, 25 insertions, 0 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 5d7fc7506ec..6609aa05947 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -55,6 +55,8 @@ #include <QtNetwork/qnetworkproxy.h> #endif +#include <qcoreapplication.h> + #include <algorithm> #include <vector> @@ -211,6 +213,29 @@ QHttp2ProtocolHandler::QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *chan } } +void QHttp2ProtocolHandler::handleConnectionClosure() +{ + // The channel has just received RemoteHostClosedError and since it will + // not try (for HTTP/2) to re-connect, it's time to finish all replies + // with error. + + // Maybe we still have some data to read and can successfully finish + // a stream/request? + _q_receiveReply(); + + // Finish all still active streams. If we previously had GOAWAY frame, + // we probably already closed some (or all) streams with ContentReSend + // error, but for those still active, not having any data to finish, + // we now report RemoteHostClosedError. + const auto errorString = QCoreApplication::translate("QHttp", "Connection closed"); + for (auto it = activeStreams.begin(), eIt = activeStreams.end(); it != eIt; ++it) + finishStreamWithError(it.value(), QNetworkReply::RemoteHostClosedError, errorString); + + // Make sure we'll never try to read anything later: + activeStreams.clear(); + goingAway = true; +} + void QHttp2ProtocolHandler::_q_uploadDataReadyRead() { if (!sender()) // QueuedConnection, firing after sender (byte device) was deleted. |
