diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | dist/changes-5.12.10 | 28 | ||||
-rw-r--r-- | dist/changes-5.15.2 | 28 | ||||
-rw-r--r-- | src/websockets/qwebsocket.cpp | 3 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 18 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.h | 19 | ||||
-rw-r--r-- | src/websockets/qwebsocketdataprocessor.cpp | 11 | ||||
-rw-r--r-- | src/websockets/qwebsocketprotocol.cpp | 2 |
8 files changed, 100 insertions, 11 deletions
diff --git a/.qmake.conf b/.qmake.conf index ba84e23..bf083d6 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -3,4 +3,4 @@ load(qt_build_config) CONFIG += warning_clean DEFINES += QT_NO_FOREACH -MODULE_VERSION = 5.15.2 +MODULE_VERSION = 5.15.9 diff --git a/dist/changes-5.12.10 b/dist/changes-5.12.10 new file mode 100644 index 0000000..c9b97b2 --- /dev/null +++ b/dist/changes-5.12.10 @@ -0,0 +1,28 @@ +Qt 5.12.10 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.9. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + https://doc.qt.io/qt-5.12/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + +**************************************************************************** +* Library * +**************************************************************************** + + diff --git a/dist/changes-5.15.2 b/dist/changes-5.15.2 new file mode 100644 index 0000000..3f584ae --- /dev/null +++ b/dist/changes-5.15.2 @@ -0,0 +1,28 @@ +Qt 5.15.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.15.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + https://doc.qt.io/qt-5.15/index.html + +The Qt version 5.15 series is binary compatible with the 5.14.x series. +Applications compiled for 5.14 will continue to run with 5.15. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + +**************************************************************************** +* Library * +**************************************************************************** + + diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp index 144268f..526c561 100644 --- a/src/websockets/qwebsocket.cpp +++ b/src/websockets/qwebsocket.cpp @@ -447,6 +447,9 @@ void QWebSocket::open(const QNetworkRequest &request) The size of the \a payload cannot be bigger than 125. If it is larger, the \a payload is clipped to 125 bytes. + \note QWebSocket and QWebSocketServer handles ping requests internally, + which means they automatically send back a pong response to the peer. + \sa pong() */ void QWebSocket::ping(const QByteArray &payload) diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 5a95215..cf3087f 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -74,7 +74,6 @@ const quint64 DEFAULT_OUTGOING_FRAME_SIZE_IN_BYTES = 512 * 512 * 2; //default si QWebSocketConfiguration::QWebSocketConfiguration() : #ifndef QT_NO_SSL - m_sslConfiguration(QSslConfiguration::defaultConfiguration()), m_ignoredSslErrors(), m_ignoreSslErrors(false), #endif @@ -271,6 +270,11 @@ QSslConfiguration QWebSocketPrivate::sslConfiguration() const void QWebSocketPrivate::ignoreSslErrors(const QList<QSslError> &errors) { m_configuration.m_ignoredSslErrors = errors; + if (Q_LIKELY(m_pSocket)) { + QSslSocket *pSslSocket = qobject_cast<QSslSocket *>(m_pSocket); + if (Q_LIKELY(pSslSocket)) + pSslSocket->ignoreSslErrors(errors); + } } /*! @@ -425,8 +429,10 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask) QSslSocket *sslSocket = new QSslSocket(q); m_pSocket = sslSocket; if (Q_LIKELY(m_pSocket)) { - m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1); - m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + QObject::connect(sslSocket, &QSslSocket::connected, [sslSocket](){ + sslSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1); + sslSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + }); m_pSocket->setReadBufferSize(m_readBufferSize); m_pSocket->setPauseMode(m_pauseMode); @@ -454,8 +460,10 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask) if (url.scheme() == QStringLiteral("ws")) { m_pSocket = new QTcpSocket(q); if (Q_LIKELY(m_pSocket)) { - m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1); - m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + QObject::connect(m_pSocket, &QTcpSocket::connected, [this](){ + m_pSocket->setSocketOption(QAbstractSocket::LowDelayOption, 1); + m_pSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1); + }); m_pSocket->setReadBufferSize(m_readBufferSize); m_pSocket->setPauseMode(m_pauseMode); diff --git a/src/websockets/qwebsocket_p.h b/src/websockets/qwebsocket_p.h index ad667aa..c193a70 100644 --- a/src/websockets/qwebsocket_p.h +++ b/src/websockets/qwebsocket_p.h @@ -90,7 +90,24 @@ public: public: #ifndef QT_NO_SSL - QSslConfiguration m_sslConfiguration; + struct TlsConfigurationLazy { + TlsConfigurationLazy &operator = (const QSslConfiguration &rhs) + { + tlsConfiguration.reset(new QSslConfiguration(rhs)); + return *this; + } + + operator QSslConfiguration() const + { + if (!tlsConfiguration.get()) + tlsConfiguration.reset(new QSslConfiguration(QSslConfiguration::defaultConfiguration())); + return *tlsConfiguration.get(); + } + + mutable std::unique_ptr<QSslConfiguration> tlsConfiguration; + }; + + TlsConfigurationLazy m_sslConfiguration; QList<QSslError> m_ignoredSslErrors; bool m_ignoreSslErrors; #endif diff --git a/src/websockets/qwebsocketdataprocessor.cpp b/src/websockets/qwebsocketdataprocessor.cpp index 0d2e927..2affdd5 100644 --- a/src/websockets/qwebsocketdataprocessor.cpp +++ b/src/websockets/qwebsocketdataprocessor.cpp @@ -202,6 +202,7 @@ bool QWebSocketDataProcessor::process(QIODevice *pIoDevice) return true; } + bool isFinalFrame = frame.isFinalFrame(); if (m_opCode == QWebSocketProtocol::OpCodeText) { QString frameTxt = m_pTextCodec->toUnicode(frame.payload().constData(), frame.payload().size(), @@ -215,14 +216,17 @@ bool QWebSocketDataProcessor::process(QIODevice *pIoDevice) return true; } else { m_textMessage.append(frameTxt); - Q_EMIT textFrameReceived(frameTxt, frame.isFinalFrame()); + frame.clear(); + Q_EMIT textFrameReceived(frameTxt, isFinalFrame); } } else { m_binaryMessage.append(frame.payload()); - Q_EMIT binaryFrameReceived(frame.payload(), frame.isFinalFrame()); + QByteArray payload = frame.payload(); + frame.clear(); + Q_EMIT binaryFrameReceived(payload, isFinalFrame); } - if (frame.isFinalFrame()) { + if (isFinalFrame) { isDone = true; if (m_opCode == QWebSocketProtocol::OpCodeText) { const QString textMessage(m_textMessage); @@ -259,6 +263,7 @@ void QWebSocketDataProcessor::clear() m_binaryMessage.clear(); m_textMessage.clear(); m_payloadLength = 0; + frame.clear(); if (m_pConverterState) { if ((m_pConverterState->remainingChars != 0) || (m_pConverterState->invalidChars != 0)) { delete m_pConverterState; diff --git a/src/websockets/qwebsocketprotocol.cpp b/src/websockets/qwebsocketprotocol.cpp index df87a93..d0465f1 100644 --- a/src/websockets/qwebsocketprotocol.cpp +++ b/src/websockets/qwebsocketprotocol.cpp @@ -210,7 +210,7 @@ void QWebSocketProtocol::mask(char *payload, quint64 size, quint32 maskingKey) quint8((maskingKey & 0x0000FF00u) >> 8), quint8((maskingKey & 0x000000FFu)) }; - int i = 0; + quint64 i = 0; while (size-- > 0) *payload++ ^= mask[i++ % 4]; } |