diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/imports/qmlwebsockets/qqmlwebsocket.h | 2 | ||||
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 4 | ||||
-rw-r--r-- | src/websockets/qwebsocketserver_p.cpp | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/.qmake.conf b/.qmake.conf index 0f49ddb..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.2 +MODULE_VERSION = 5.13.0 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/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 8529538..c8bee53 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; 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, |