mirror of https://github.com/qt/qtgrpc.git
QGrpcHttp2Channel: Report data loss for incomplete trailing messages
In case we receive the endStream flag when processing received data, we now return a non-ok QGrpcStatus if there's still unprocessed data in the intermediate container. [ChangeLog][QGrpcHttp2Channel][Important Behavior Changes] finishes the communication with a non-ok QGrpcStatus (DataLoss) when the stream is closed with unprocessed trailing data. Pick-to: 6.10 6.9 6.8 Change-Id: I53d36c012d6cab57f4d8b652518ff5ccd5be24f2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
88b73b67b0
commit
dbf2b504c7
|
|
@ -546,8 +546,15 @@ void Http2Handler::attachStream(QHttp2Stream *stream_)
|
|||
emit m_context->messageReceived(frame->payload);
|
||||
}
|
||||
|
||||
if (endStream)
|
||||
if (endStream) {
|
||||
if (const auto bytes = m_grpcDataParser.bytesAvailable()) {
|
||||
finish({ QtGrpc::StatusCode::DataLoss,
|
||||
"Unexcpected end of stream with %1 bytes remaining"_L1
|
||||
.arg(QString::number(bytes)) });
|
||||
return;
|
||||
}
|
||||
finish({});
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_stream.get(), &QHttp2Stream::uploadFinished, this, &Http2Handler::processQueue);
|
||||
|
|
|
|||
Loading…
Reference in New Issue