summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Edelev <semlanik@gmail.com>2019-03-28 11:58:04 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2019-03-29 14:31:31 +0000
commit20b7e18146e28e73cba52a63a3415c6828f1f6f5 (patch)
treecec9ab0c4d61a6c91360cd0a58f16267845e7c28
parent743e883c12edcc1d5e22a50eea4f7f28fc7b8188 (diff)
Fix a crash in QHttp2ProtocolHandler in h2c-direct mode
After 'h2c' mode was implemented with the proper protocol upgrade, the previously working 'direct connection' mode was lost for clear text connections due to the erroneous logic in the constructor: having !channel->ssl does not necessary mean we started with HTTP/1.1 request, including protocol upgrade header; it can also mean we connected a plain socket and immediately sending h2 frames, without any H2 negotiation at all. Fixes: QTBUG-74765 Change-Id: Ice466d6bffb40048b7ab46fb064f2d3d795a12aa Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index d5221a4934..35aee6e3e1 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -198,7 +198,7 @@ QHttp2ProtocolHandler::QHttp2ProtocolHandler(QHttpNetworkConnectionChannel *chan
}
}
- if (!channel->ssl) {
+ if (!channel->ssl && m_connection->connectionType() != QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
// We upgraded from HTTP/1.1 to HTTP/2. channel->request was already sent
// as HTTP/1.1 request. The response with status code 101 triggered
// protocol switch and now we are waiting for the real response, sent