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>
This commit is contained in:
parent
743e883c12
commit
20b7e18146
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user