path: root/src/network
diff options
authorMårten Nordheim <>2019-03-04 12:24:10 +0100
committerMårten Nordheim <>2019-03-06 11:08:19 +0000
commite431a3ac027915dbfc0588f42f3b56e07639811e (patch)
tree7ead7bb94a91a931b44370f04f4cc68fb5f2832c /src/network
parent7831b276e610368514087a81396d1ca2425b2e42 (diff)
Don't retry a ssl connection if encryption was never finished
As explained in the inline comment we don't actually have a protocol handler until we're done encrypting when we use SSL, but we would still retry the connection if an error occurred between "connected" and "encrypted". This would then lead us to fail an assert that checked if a protocol handler had been set Fixes: QTBUG-47822 Change-Id: If7f4ef4f70e72b764f492e7ced5a9349b3a421d2 Reviewed-by: Timur Pocheptsov <>
Diffstat (limited to 'src/network')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 5726925cb0..d5f63af745 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -966,7 +966,10 @@ void QHttpNetworkConnectionChannel::_q_error(QAbstractSocket::SocketError socket
} else if (state != QHttpNetworkConnectionChannel::IdleState && state != QHttpNetworkConnectionChannel::ReadingState) {
// Try to reconnect/resend before sending an error.
// While "Reading" the _q_disconnected() will handle this.
- if (reconnectAttempts-- > 0) {
+ // If we're using ssl then the protocolHandler is not initialized until
+ // "encrypted" has been emitted, since retrying requires the protocolHandler (asserted)
+ // we will not try if encryption is not done.
+ if (!pendingEncrypt && reconnectAttempts-- > 0) {
} else {