diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | dist/changes-5.13.0 | 18 | ||||
-rw-r--r-- | examples/websockets/doc/echoserver.qdoc | 2 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/plugins.qmltypes | 4 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/qmlwebsockets.pro | 2 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp | 3 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/qqmlwebsocket.cpp | 8 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/qqmlwebsocket.h | 2 | ||||
-rw-r--r-- | src/websockets/doc/src/index.qdoc | 6 | ||||
-rw-r--r-- | src/websockets/doc/src/qtwebsockets-module.qdoc | 8 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 6 | ||||
-rw-r--r-- | src/websockets/qwebsocket_wasm_p.cpp | 6 | ||||
-rw-r--r-- | src/websockets/qwebsocketserver_p.cpp | 4 |
13 files changed, 53 insertions, 18 deletions
diff --git a/.qmake.conf b/.qmake.conf index bbb67e5..b5e35ea 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.12.5 +MODULE_VERSION = 5.13.1 diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0 new file mode 100644 index 0000000..ebb4be1 --- /dev/null +++ b/dist/changes-5.13.0 @@ -0,0 +1,18 @@ +Qt 5.13 introduces many new features and improvements as well as bugfixes +over the 5.12.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.13 series is binary compatible with the 5.12.x series. +Applications compiled for 5.12 will continue to run with 5.13. + +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. + + - This release contains only minor code improvements. diff --git a/examples/websockets/doc/echoserver.qdoc b/examples/websockets/doc/echoserver.qdoc index 702d80d..76a37ce 100644 --- a/examples/websockets/doc/echoserver.qdoc +++ b/examples/websockets/doc/echoserver.qdoc @@ -59,7 +59,7 @@ sends back the messages it receives, using the \l {Qt WebSockets}{WebSocket} API. If your web browser supports \l {Qt WebSockets}{WebSocket}, you can also use it - to open the \l {echoserver/echoclient.html}{echoclient.html} file, and operate + to open the \c {echoserver/echoclient.html}{echoclient.html} file, and operate like the following screenshot. \image echoclient-html-example.png Screenshot of the HTML version of Echo diff --git a/src/imports/qmlwebsockets/plugins.qmltypes b/src/imports/qmlwebsockets/plugins.qmltypes index 2fb57cd..79e2f97 100644 --- a/src/imports/qmlwebsockets/plugins.qmltypes +++ b/src/imports/qmlwebsockets/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtWebSockets 1.1' +// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtWebSockets 1.13' Module { dependencies: [] @@ -38,7 +38,7 @@ Module { } Signal { name: "statusChanged" - Parameter { name: "status"; type: "Status" } + Parameter { name: "status"; type: "QQmlWebSocket::Status" } } Signal { name: "activeChanged" diff --git a/src/imports/qmlwebsockets/qmlwebsockets.pro b/src/imports/qmlwebsockets/qmlwebsockets.pro index 7b6fc86..c058918 100644 --- a/src/imports/qmlwebsockets/qmlwebsockets.pro +++ b/src/imports/qmlwebsockets/qmlwebsockets.pro @@ -12,6 +12,6 @@ SOURCES += qmlwebsockets_plugin.cpp \ OTHER_FILES += qmldir -IMPORT_VERSION = 1.1 +IMPORT_VERSION = 1.$$QT_MINOR_VERSION load(qml_plugin) diff --git a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp index 24fe34a..467e08c 100644 --- a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp +++ b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp @@ -55,6 +55,9 @@ void QtWebSocketsDeclarativeModule::registerTypes(const char *uri) qmlRegisterType<QQmlWebSocket>(uri, 1 /*major*/, 0 /*minor*/, "WebSocket"); qmlRegisterType<QQmlWebSocket, 1>(uri, 1 /*major*/, 1 /*minor*/, "WebSocket"); qmlRegisterType<QQmlWebSocketServer>(uri, 1 /*major*/, 0 /*minor*/, "WebSocketServer"); + + // Auto-increment the import to stay in sync with ALL future QtQuick minor versions + qmlRegisterModule(uri, 1, QT_VERSION_MINOR); } QT_END_NAMESPACE diff --git a/src/imports/qmlwebsockets/qqmlwebsocket.cpp b/src/imports/qmlwebsockets/qqmlwebsocket.cpp index 37a2fad..7f862e0 100644 --- a/src/imports/qmlwebsockets/qqmlwebsocket.cpp +++ b/src/imports/qmlwebsockets/qqmlwebsocket.cpp @@ -87,31 +87,33 @@ /*! \qmlsignal WebSocket::textMessageReceived(QString message) This signal is emitted when a text message is received. + \a message contains the bytes received. */ /*! \qmlsignal WebSocket::binaryMessageReceived(QString message) \since 5.8 This signal is emitted when a binary message is received. + \a message contains the bytes received. */ /*! \qmlsignal WebSocket::statusChanged(Status status) This signal is emitted when the status of the WebSocket changes. - the \l [QML]{WebSocket::status}{status} argument provides the current status. + The \a status argument provides the current status. \sa {QtWebSockets::}{WebSocket::status} */ /*! \qmlmethod void WebSocket::sendTextMessage(string message) - Sends \c message to the server. + Sends \a message to the server. */ /*! \qmlmethod void WebSocket::sendBinaryMessage(ArrayBuffer message) \since 5.8 - Sends \c message to the server. + Sends the parameter \a message to the server. */ #include "qqmlwebsocket.h" diff --git a/src/imports/qmlwebsockets/qqmlwebsocket.h b/src/imports/qmlwebsockets/qqmlwebsocket.h index e1ffc72..7662607 100644 --- a/src/imports/qmlwebsockets/qqmlwebsocket.h +++ b/src/imports/qmlwebsockets/qqmlwebsocket.h @@ -88,7 +88,7 @@ public: Q_SIGNALS: void textMessageReceived(QString message); Q_REVISION(1) void binaryMessageReceived(QByteArray message); - void statusChanged(Status status); + void statusChanged(QQmlWebSocket::Status status); void activeChanged(bool isActive); void errorStringChanged(QString errorString); void urlChanged(); diff --git a/src/websockets/doc/src/index.qdoc b/src/websockets/doc/src/index.qdoc index c23f6fe..81a2cb4 100644 --- a/src/websockets/doc/src/index.qdoc +++ b/src/websockets/doc/src/index.qdoc @@ -51,9 +51,9 @@ To import the QML types into your application, use the following import statement in your .qml file: - \code - import QtWebSockets 1.0 - \endcode + \qml \QtMinorVersion + import QtWebSockets 1.\1 + \endqml To link against the module, add this line to your qmake .pro file: diff --git a/src/websockets/doc/src/qtwebsockets-module.qdoc b/src/websockets/doc/src/qtwebsockets-module.qdoc index c1f7958..83c561d 100644 --- a/src/websockets/doc/src/qtwebsockets-module.qdoc +++ b/src/websockets/doc/src/qtwebsockets-module.qdoc @@ -48,16 +48,16 @@ */ /*! - \qmlmodule QtWebSockets 1.1 + \qmlmodule QtWebSockets 1.\QtMinorVersion \title Qt WebSockets QML Types \ingroup qmlmodules \brief Provides QML types for WebSocket-based communication. The QML types are accessed by using: - \code - import QtWebSockets 1.1 - \endcode + \qml \QtMinorVersion + import QtWebSockets 1.\1 + \endqml \note Prior to Qt 5.5, the import statement was \c{import Qt.WebSockets 1.0} (notice the dot between \c Qt and \c WebSockets). The old statement is still diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 8529538..6965731 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -436,6 +436,7 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask) sslSocket->ignoreSslErrors(m_configuration.m_ignoredSslErrors); #ifndef QT_NO_NETWORKPROXY sslSocket->setProxy(m_configuration.m_proxy); + m_pSocket->setProtocolTag(QStringLiteral("https")); #endif sslSocket->connectToHostEncrypted(url.host(), quint16(url.port(443))); } else { @@ -458,6 +459,7 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask) setSocketState(QAbstractSocket::ConnectingState); #ifndef QT_NO_NETWORKPROXY m_pSocket->setProxy(m_configuration.m_proxy); + m_pSocket->setProtocolTag(QStringLiteral("http")); #endif m_pSocket->connectToHost(url.host(), quint16(url.port(80))); } else { @@ -965,7 +967,7 @@ void QWebSocketPrivate::processHandshake(QTcpSocket *pSocket) case ReadingStatusState: if (!pSocket->canReadLine()) return; - m_statusLine = pSocket->readLine(); + m_statusLine = pSocket->readLine().trimmed(); if (Q_UNLIKELY(!parseStatusLine(m_statusLine, &m_httpMajorVersion, &m_httpMinorVersion, &m_httpStatusCode, &m_httpStatusMessage))) { errorDescription = QWebSocket::tr("Invalid statusline in response: %1.").arg(QString::fromLatin1(m_statusLine)); break; @@ -1449,6 +1451,7 @@ void QWebSocketPrivate::setReadBufferSize(qint64 size) m_pSocket->setReadBufferSize(m_readBufferSize); } +#ifndef Q_OS_WASM /*! \internal */ @@ -1457,5 +1460,6 @@ bool QWebSocketPrivate::isValid() const return (m_pSocket && m_pSocket->isValid() && (m_socketState == QAbstractSocket::ConnectedState)); } +#endif QT_END_NAMESPACE diff --git a/src/websockets/qwebsocket_wasm_p.cpp b/src/websockets/qwebsocket_wasm_p.cpp index 922d6a8..199fe44 100644 --- a/src/websockets/qwebsocket_wasm_p.cpp +++ b/src/websockets/qwebsocket_wasm_p.cpp @@ -187,3 +187,9 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask) socketContext.set("onmessage", val::module_property("QWebSocketPrivate_onIncomingMessageCallback")); socketContext.set("data-context", val(quintptr(reinterpret_cast<void *>(this)))); } + +bool QWebSocketPrivate::isValid() const +{ + return (!socketContext.isUndefined() && + (m_socketState == QAbstractSocket::ConnectedState)); +} diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp index f3e7eac..3a38c4b 100644 --- a/src/websockets/qwebsocketserver_p.cpp +++ b/src/websockets/qwebsocketserver_p.cpp @@ -416,7 +416,9 @@ void QWebSocketServerPrivate::handshakeReceived() //For Safari, the handshake is delivered at once //FIXME: For FireFox, the readyRead signal is never emitted //This is a bug in FireFox (see https://bugzilla.mozilla.org/show_bug.cgi?id=594502) - if (!pTcpSocket->canReadLine()) { + + // According to RFC822 the body is separated from the headers by a null line (CRLF) + if (!pTcpSocket->peek(pTcpSocket->bytesAvailable()).endsWith(QByteArrayLiteral("\r\n\r\n"))) { return; } disconnect(pTcpSocket, &QTcpSocket::readyRead, |