summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2021-07-12 11:28:19 +0200
committerMarc Mutz <marc.mutz@kdab.com>2021-07-16 23:41:34 +0200
commit9cc0c64e0857ded99e5031548ae9b7fc8107caf8 (patch)
tree81c7f460b8ef07c654de3215dc1e3d68a912be72 /src/network/access
parent2915921ad2a79a4ce1651dc7297f6571788d1413 (diff)
SSL: port QSharedPointer<QSslContext> uses to std-compatible API subset
In preparation of porting to shared_ptr. Add a few strategic moves and remove a rather pointless comment stating the obvious. Change-Id: Ie1c0f3431af79bdb204e00d99323bf9f2d100d0d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 22b1cd0ec3..5c0097daa5 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -393,8 +393,8 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
// check whether we can re-use an existing SSL session
// (meaning another socket in this connection has already
// performed a full handshake)
- if (!connection->sslContext().isNull())
- QSslSocketPrivate::checkSettingSslContext(sslSocket, connection->sslContext());
+ if (auto ctx = connection->sslContext())
+ QSslSocketPrivate::checkSettingSslContext(sslSocket, std::move(ctx));
sslSocket->setPeerVerifyName(connection->d_func()->peerVerifyName);
sslSocket->connectToHostEncrypted(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference);
@@ -925,12 +925,11 @@ void QHttpNetworkConnectionChannel::_q_connected()
//channels[i].reconnectAttempts = 2;
if (ssl || pendingEncrypt) { // FIXME: Didn't work properly with pendingEncrypt only, we should refactor this into an EncrypingState
#ifndef QT_NO_SSL
- if (connection->sslContext().isNull()) {
+ if (!connection->sslContext()) {
// this socket is making the 1st handshake for this connection,
// we need to set the SSL context so new sockets can reuse it
- QSharedPointer<QSslContext> socketSslContext = QSslSocketPrivate::sslContext(static_cast<QSslSocket*>(socket));
- if (!socketSslContext.isNull())
- connection->setSslContext(socketSslContext);
+ if (auto socketSslContext = QSslSocketPrivate::sslContext(static_cast<QSslSocket*>(socket)))
+ connection->setSslContext(std::move(socketSslContext));
}
#endif
} else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {