summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-04-05 13:05:05 +0200
committerLiang Qi <liang.qi@qt.io>2018-04-05 19:56:55 +0000
commit1c463000ed7427ef6b311b5ae30b91b0570754d1 (patch)
treea3bd553cef495109d0a298804a59a96b312d5203
parent3c8181de7006cab3c2d736dfb4adabe9b2ffaf4e (diff)
HTTP/2 - treat HEADERS frames as valid for streams in 'open' state
Previously, I erroneously expected HEADERS frame only on a stream, which is in half-closed (local) or reserved (remote) state. But 'open' state is also valid (RFC7540, 6.2). For example, we start uploading some data, we have sent HEADERS frame and now are sending DATA frames, without END_STREAM flag set yet; this stream is in 'open' state. If a server wants to reply with some error status code or redirect - it does not have to wait for our END_STREAM flag, reading all this data that will be discarded anyway. Task-number: QTBUG-67469 Change-Id: I53e3a5e9b2ab7f7917ae083ba44e862a227db238 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index 0cdcee6b59..5420e713b5 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -917,10 +917,11 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS()
if (activeStreams.contains(streamID)) {
Stream &stream = activeStreams[streamID];
if (stream.state != Stream::halfClosedLocal
- && stream.state != Stream::remoteReserved) {
+ && stream.state != Stream::remoteReserved
+ && stream.state != Stream::open) {
// We can receive HEADERS on streams initiated by our requests
- // (these streams are in halfClosedLocal state) or remote-reserved
- // streams from a server's PUSH_PROMISE.
+ // (these streams are in halfClosedLocal or open state) or
+ // remote-reserved streams from a server's PUSH_PROMISE.
finishStreamWithError(stream, QNetworkReply::ProtocolFailure,
QLatin1String("HEADERS on invalid stream"));
sendRST_STREAM(streamID, CANCEL);