summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttp2protocolhandler.cpp
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2024-06-25 17:09:35 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-07-03 05:31:50 +0200
commitb1e75376cc3adfc7da5502a277dfe9711f3e0536 (patch)
tree3d4764460e9cbf0140145a02e972c8fd9316e77a /src/network/access/qhttp2protocolhandler.cpp
parent00d3fcf1093c81fd343bd13ab0e9713d4ac0858f (diff)
HTTP2: Delay any communication until encrypted() can be responded to
We have the encrypted() signal that lets users do extra checks on the established connection. It is emitted as BlockingQueued, so the HTTP thread stalls until it is done emitting. Users can potentially call abort() on the QNetworkReply at that point, which is passed as a Queued call back to the HTTP thread. That means that any currently queued signal emission will be processed before the abort() call is processed. In the case of HTTP2 it is a little special since it is multiplexed and the code is built to start requests as they are available. This means that, while the code worked fine for HTTP1, since one connection only has one request, it is not working for HTTP2, since we try to send more requests in-between the encrypted() signal and the abort() call. This patch changes the code to delay any communication until the encrypted() signal has been emitted and processed, for HTTP2 only. It's done by adding a few booleans, both to know that we have to return early and so we can keep track of what events arose and what we need to resume once enough time has passed that any abort() call must have been processed. Fixes: QTBUG-126610 Pick-to: 6.8 6.7 6.5 6.2 5.15 5.12 Change-Id: Ic25a600c278203256e35f541026f34a8783235ae Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/network/access/qhttp2protocolhandler.cpp')
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index 3d55cee1ebd..2d1e01e3cdf 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -304,12 +304,12 @@ bool QHttp2ProtocolHandler::sendRequest()
}
}
- if (!prefaceSent && !sendClientPreface())
- return false;
-
if (!requests.size())
return true;
+ if (!prefaceSent && !sendClientPreface())
+ return false;
+
m_channel->state = QHttpNetworkConnectionChannel::WritingState;
// Check what was promised/pushed, maybe we do not have to send a request
// and have a response already?