summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--examples/websockets/doc/echoserver.qdoc2
-rw-r--r--src/imports/qmlwebsockets/plugins.qmltypes4
-rw-r--r--src/imports/qmlwebsockets/qmlwebsockets.pro2
-rw-r--r--src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp3
-rw-r--r--src/imports/qmlwebsockets/qqmlwebsocket.h2
-rw-r--r--src/websockets/doc/src/index.qdoc6
-rw-r--r--src/websockets/doc/src/qtwebsockets-module.qdoc8
-rw-r--r--src/websockets/qwebsocket_p.cpp6
-rw-r--r--src/websockets/qwebsocket_wasm_p.cpp6
-rw-r--r--src/websockets/qwebsocketserver_p.cpp4
11 files changed, 30 insertions, 15 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 7e57b5b..ffdb3bf 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.3
+MODULE_VERSION = 5.13.0
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.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,