diff options
author | André Klitzing <aklitzing@gmail.com> | 2017-10-19 16:05:17 +0200 |
---|---|---|
committer | André Klitzing <aklitzing@gmail.com> | 2017-10-27 14:58:36 +0000 |
commit | 203da360c4bcd64bdd17639d495f1857b622e92d (patch) | |
tree | 5f471ced4bdd07dddab93fdf00f3139c01fe79b5 /tests | |
parent | 905a6cea6c205015445bcd11c8f2616576a092c5 (diff) | |
download | qtwebsockets-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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
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 } |