summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Klitzing <aklitzing@gmail.com>2017-10-19 14:05:17 (GMT)
committerAndré Klitzing <aklitzing@gmail.com>2017-10-27 14:58:36 (GMT)
commit203da360c4bcd64bdd17639d495f1857b622e92d (patch)
tree5f471ced4bdd07dddab93fdf00f3139c01fe79b5
parent905a6cea6c205015445bcd11c8f2616576a092c5 (diff)
downloadqtwebsockets-203da360c4bcd64bdd17639d495f1857b622e92d.tar.gz
Fix empty sslConfiguration in sslErrors slot
If QWebSocket fires signal sslErrors the QSslConfiguration of QWebSocket is not updated. So client application cannot check it in implemented slot. Fix this by calling the update method like for encrypted signal. Sibling of QTBUG-40401. Change-Id: I18b39f6b6a0791ae67fc2bff5cf2c04a22b0ab85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/websockets/qwebsocket_p.cpp3
-rw-r--r--tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp10
2 files changed, 10 insertions, 3 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 7863567..bee2afa 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -596,6 +596,9 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
QObject::connect(sslSocket, &QSslSocket::encryptedBytesWritten, q,
&QWebSocket::bytesWritten);
typedef void (QSslSocket:: *sslErrorSignalType)(const QList<QSslError> &);
+ QObjectPrivate::connect(sslSocket,
+ static_cast<sslErrorSignalType>(&QSslSocket::sslErrors),
+ this, &QWebSocketPrivate::_q_updateSslConfiguration);
QObject::connect(sslSocket,
static_cast<sslErrorSignalType>(&QSslSocket::sslErrors),
q, &QWebSocket::sslErrors);
diff --git a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
index 82a873d..b7734a4 100644
--- a/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
+++ b/tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp
@@ -31,9 +31,9 @@
#include <QTcpServer>
#ifndef QT_NO_OPENSSL
#include <QtNetwork/qsslpresharedkeyauthenticator.h>
-#include <QtNetwork/qsslcipher.h>
#endif
#ifndef QT_NO_SSL
+#include <QtNetwork/qsslcipher.h>
#include <QtNetwork/qsslkey.h>
#endif
#include <QtWebSockets/QWebSocketServer>
@@ -539,10 +539,13 @@ void tst_QWebSocketServer::tst_scheme()
QVERIFY(secureServer.listen());
+ QSslCipher sessionCipher;
QWebSocket secureSocket;
- typedef void (QWebSocket::* ignoreSslErrorsSlot)();
connect(&secureSocket, &QWebSocket::sslErrors,
- &secureSocket, static_cast<ignoreSslErrorsSlot>(&QWebSocket::ignoreSslErrors));
+ &secureSocket, [&] {
+ secureSocket.ignoreSslErrors();
+ sessionCipher = secureSocket.sslConfiguration().sessionCipher();
+ });
secureSocket.open(secureServer.serverUrl().toString());
QTRY_COMPARE(secureServerConnectionSpy.count(), 1);
@@ -550,6 +553,7 @@ void tst_QWebSocketServer::tst_scheme()
QVERIFY(!secureServerSocket.isNull());
QCOMPARE(secureServerSocket->requestUrl().scheme(), QStringLiteral("wss"));
secureServer.close();
+ QVERIFY(!sessionCipher.isNull());
#endif
}