diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/websockets/qmaskgenerator.h | 2 | ||||
-rw-r--r-- | src/websockets/qwebsocket.h | 2 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 19 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.h | 1 | ||||
-rw-r--r-- | src/websockets/qwebsocketserver.h | 2 |
5 files changed, 23 insertions, 3 deletions
diff --git a/src/websockets/qmaskgenerator.h b/src/websockets/qmaskgenerator.h index 4a13b1d..b366abf 100644 --- a/src/websockets/qmaskgenerator.h +++ b/src/websockets/qmaskgenerator.h @@ -44,7 +44,7 @@ class Q_WEBSOCKETS_EXPORT QMaskGenerator : public QObject Q_DISABLE_COPY(QMaskGenerator) public: - explicit QMaskGenerator(QObject *parent = 0); + explicit QMaskGenerator(QObject *parent = Q_NULLPTR); virtual ~QMaskGenerator(); virtual bool seed() = 0; diff --git a/src/websockets/qwebsocket.h b/src/websockets/qwebsocket.h index 7ee4bc6..0c2d9fb 100644 --- a/src/websockets/qwebsocket.h +++ b/src/websockets/qwebsocket.h @@ -62,7 +62,7 @@ class Q_WEBSOCKETS_EXPORT QWebSocket : public QObject public: explicit QWebSocket(const QString &origin = QString(), QWebSocketProtocol::Version version = QWebSocketProtocol::VersionLatest, - QObject *parent = 0); + QObject *parent = Q_NULLPTR); virtual ~QWebSocket(); void abort(); diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 1722c15..0eadc93 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -275,6 +275,15 @@ void QWebSocketPrivate::ignoreSslErrors() } } +/*! +* \internal +*/ +void QWebSocketPrivate::_q_updateSslConfiguration() +{ + if (QSslSocket *sslSock = qobject_cast<QSslSocket *>(m_pSocket)) + m_configuration.m_sslConfiguration = sslSock->sslConfiguration(); +} + #endif /*! @@ -294,6 +303,10 @@ QWebSocket *QWebSocketPrivate::upgradeFrom(QTcpSocket *pTcpSocket, headerIter.next(); netRequest.setRawHeader(headerIter.key().toLatin1(), headerIter.value().toLatin1()); } +#ifndef QT_NO_SSL + if (QSslSocket *sslSock = qobject_cast<QSslSocket *>(pTcpSocket)) + pWebSocket->setSslConfiguration(sslSock->sslConfiguration()); +#endif pWebSocket->d_func()->setExtension(response.acceptedExtension()); pWebSocket->d_func()->setOrigin(request.origin()); pWebSocket->d_func()->setRequest(netRequest); @@ -579,6 +592,8 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket) QObject::connect(sslSocket, static_cast<sslErrorSignalType>(&QSslSocket::sslErrors), q, &QWebSocket::sslErrors); + QObjectPrivate::connect(sslSocket, &QSslSocket::encrypted, + this, &QWebSocketPrivate::_q_updateSslConfiguration); } else #endif // QT_NO_SSL { @@ -1058,6 +1073,10 @@ void QWebSocketPrivate::processStateChanged(QAbstractSocket::SocketState socketS switch (socketState) { case QAbstractSocket::ConnectedState: +#ifndef QT_NO_SSL + if (QSslSocket *sslSock = qobject_cast<QSslSocket *>(m_pSocket)) + m_configuration.m_sslConfiguration = sslSock->sslConfiguration(); +#endif if (webSocketState == QAbstractSocket::ConnectingState) { m_key = generateKey(); diff --git a/src/websockets/qwebsocket_p.h b/src/websockets/qwebsocket_p.h index 037df61..b7e1a81 100644 --- a/src/websockets/qwebsocket_p.h +++ b/src/websockets/qwebsocket_p.h @@ -141,6 +141,7 @@ public: void ignoreSslErrors(); void setSslConfiguration(const QSslConfiguration &sslConfiguration); QSslConfiguration sslConfiguration() const; + void _q_updateSslConfiguration(); #endif void closeGoingAway(); diff --git a/src/websockets/qwebsocketserver.h b/src/websockets/qwebsocketserver.h index 71a2ddc..abe654d 100644 --- a/src/websockets/qwebsocketserver.h +++ b/src/websockets/qwebsocketserver.h @@ -69,7 +69,7 @@ public: }; explicit QWebSocketServer(const QString &serverName, SslMode secureMode, - QObject *parent = 0); + QObject *parent = Q_NULLPTR); virtual ~QWebSocketServer(); bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); |