HTTP2: Fix handling of GOAWAY frames
Previously there were two issues: - A QNetworkReply could be aborted but be in NoError state. (GOAWAY frame with 0 as error) - Streams in a connection would be aborted prematurely when a GOAWAY frame with a lastStreamId of 2^31-1 was received. Fixes: QTBUG-73947 Change-Id: Iddee9385c1db3cc4bb80e07efac7220fff787bf3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
047633a945
commit
6c0ced4b7a
|
|
@ -818,7 +818,6 @@ void QHttp2ProtocolHandler::handleGOAWAY()
|
|||
// and a NO_ERROR code."
|
||||
if (lastStreamID != Http2::lastValidStreamID || errorCode != HTTP2_NO_ERROR)
|
||||
return connectionError(PROTOCOL_ERROR, "GOAWAY invalid stream/error code");
|
||||
lastStreamID = 1;
|
||||
} else {
|
||||
lastStreamID += 2;
|
||||
}
|
||||
|
|
@ -836,6 +835,14 @@ void QHttp2ProtocolHandler::handleGOAWAY()
|
|||
QString message;
|
||||
qt_error(errorCode, error, message);
|
||||
|
||||
// Even if the GOAWAY frame contains NO_ERROR we must send an error
|
||||
// when terminating streams to ensure users can distinguish from a
|
||||
// successful completion.
|
||||
if (errorCode == HTTP2_NO_ERROR) {
|
||||
error = QNetworkReply::ContentReSendError;
|
||||
message = QLatin1String("Server stopped accepting new streams before this stream was established");
|
||||
}
|
||||
|
||||
for (quint32 id = lastStreamID; id < nextID; id += 2) {
|
||||
const auto it = activeStreams.find(id);
|
||||
if (it != activeStreams.end()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue