summaryrefslogtreecommitdiff
path: root/src/websockets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-20 13:18:51 +0100
committerLiang Qi <liang.qi@qt.io>2017-11-20 15:05:51 +0100
commit534ed7ddbe86c58dc7d59c5c693b027ed8f18737 (patch)
treeb5fe6e7deec116c213f7eadc5a3b142600bb2a1b /src/websockets
parentf7c5b8fce9517b3062eeab0ec7e8e46867d1f977 (diff)
parent57e1ebecf0e9e1fbc23f7fe32a90c63e242e692b (diff)
downloadqtwebsockets-534ed7ddbe86c58dc7d59c5c693b027ed8f18737.tar.gz
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/websockets/qwebsocket_p.cpp tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp Change-Id: I40922fab198a09a3fbba1b2f11b42f2d40e53720
Diffstat (limited to 'src/websockets')
-rw-r--r--src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp8
-rw-r--r--src/websockets/doc/src/external-resources.qdoc10
-rw-r--r--src/websockets/doc/src/index.qdoc8
-rw-r--r--src/websockets/doc/src/overview.qdoc10
-rw-r--r--src/websockets/doc/src/qtwebsockets-module.qdoc8
-rw-r--r--src/websockets/qdefaultmaskgenerator_p.cpp8
-rw-r--r--src/websockets/qmaskgenerator.cpp2
-rw-r--r--src/websockets/qwebsocket.cpp2
-rw-r--r--src/websockets/qwebsocket_p.cpp3
-rw-r--r--src/websockets/qwebsocketserver_p.cpp5
10 files changed, 36 insertions, 28 deletions
diff --git a/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp b/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp
index 9ce9ef0..78874a3 100644
--- a/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp
+++ b/src/websockets/doc/snippets/src_websockets_ssl_qwebsocket.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/websockets/doc/src/external-resources.qdoc b/src/websockets/doc/src/external-resources.qdoc
index 933ef7f..40e4257 100644
--- a/src/websockets/doc/src/external-resources.qdoc
+++ b/src/websockets/doc/src/external-resources.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/websockets/doc/src/index.qdoc b/src/websockets/doc/src/index.qdoc
index 4f25589..919e2fc 100644
--- a/src/websockets/doc/src/index.qdoc
+++ b/src/websockets/doc/src/index.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/websockets/doc/src/overview.qdoc b/src/websockets/doc/src/overview.qdoc
index e85461a..48a790f 100644
--- a/src/websockets/doc/src/overview.qdoc
+++ b/src/websockets/doc/src/overview.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/websockets/doc/src/qtwebsockets-module.qdoc b/src/websockets/doc/src/qtwebsockets-module.qdoc
index 971e22c..c1f7958 100644
--- a/src/websockets/doc/src/qtwebsockets-module.qdoc
+++ b/src/websockets/doc/src/qtwebsockets-module.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Kurt Pattyn <pattyn.kurt@gmail.com>
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/websockets/qdefaultmaskgenerator_p.cpp b/src/websockets/qdefaultmaskgenerator_p.cpp
index 7dc0cee..7763868 100644
--- a/src/websockets/qdefaultmaskgenerator_p.cpp
+++ b/src/websockets/qdefaultmaskgenerator_p.cpp
@@ -48,7 +48,7 @@
malicious scripts to attack bad behaving proxies.
For more information about the importance of good masking,
see \l {"Talking to Yourself for Fun and Profit" by Lin-Shung Huang et al}.
- The default mask generator uses the reasonably secure QRandomGenerator::get32() function.
+ The default mask generator uses the reasonably secure QRandomGenerator::global()->generate() function.
The best measure against attacks mentioned in the document above,
is to use QWebSocket over a secure connection (\e wss://).
In general, always be careful to not have 3rd party script access to
@@ -90,16 +90,16 @@ bool QDefaultMaskGenerator::seed() Q_DECL_NOEXCEPT
}
/*!
- Generates a new random mask using the insecure QRandomGenerator::get32() method.
+ Generates a new random mask using the insecure QRandomGenerator::global()->generate() method.
\internal
*/
quint32 QDefaultMaskGenerator::nextMask() Q_DECL_NOEXCEPT
{
- quint32 value = QRandomGenerator::get32();
+ quint32 value = QRandomGenerator::global()->generate();
while (Q_UNLIKELY(value == 0)) {
// a mask of zero has a special meaning
- value = QRandomGenerator::get32();
+ value = QRandomGenerator::global()->generate();
}
return value;
}
diff --git a/src/websockets/qmaskgenerator.cpp b/src/websockets/qmaskgenerator.cpp
index 56d1223..40f8594 100644
--- a/src/websockets/qmaskgenerator.cpp
+++ b/src/websockets/qmaskgenerator.cpp
@@ -50,7 +50,7 @@
malicious scripts from attacking badly behaving proxies.
For more information about the importance of good masking,
see \l {"Talking to Yourself for Fun and Profit" by Lin-Shung Huang et al}.
- By default QWebSocket uses the reasonably secure QRandomGenerator::get32() function.
+ By default QWebSocket uses the reasonably secure QRandomGenerator::global()->generate() function.
The best measure against attacks mentioned in the document above,
is to use QWebSocket over a secure connection (\e wss://).
In general, always be careful to not have 3rd party script access to
diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp
index 7a017b5..1b0fc35 100644
--- a/src/websockets/qwebsocket.cpp
+++ b/src/websockets/qwebsocket.cpp
@@ -64,7 +64,7 @@
this problem is to use WebSocket over a secure connection.
\warning To generate masks, this implementation of WebSockets uses the reasonably
- secure QRandomGenerator::get32() function.
+ secure QRandomGenerator::global()->generate() function.
For more information about the importance of good masking,
see \l {"Talking to Yourself for Fun and Profit" by Lin-Shung Huang et al}.
The best measure against attacks mentioned in the document above,
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 1a1bb1f..1cfa106 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -593,6 +593,9 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
&QWebSocket::preSharedKeyAuthenticationRequired);
QObject::connect(sslSocket, &QSslSocket::encryptedBytesWritten, q,
&QWebSocket::bytesWritten);
+ QObjectPrivate::connect(sslSocket,
+ QOverload<const QList<QSslError>&>::of(&QSslSocket::sslErrors),
+ this, &QWebSocketPrivate::_q_updateSslConfiguration);
QObject::connect(sslSocket,
QOverload<const QList<QSslError>&>::of(&QSslSocket::sslErrors),
q, &QWebSocket::sslErrors);
diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp
index 13f86de..59b50e7 100644
--- a/src/websockets/qwebsocketserver_p.cpp
+++ b/src/websockets/qwebsocketserver_p.cpp
@@ -490,6 +490,11 @@ void QWebSocketServerPrivate::handleConnection(QTcpSocket *pTcpSocket) const
QObjectPrivate::connect(pTcpSocket, &QTcpSocket::readyRead,
this, &QWebSocketServerPrivate::handshakeReceived,
Qt::QueuedConnection);
+ if (pTcpSocket->canReadLine()) {
+ // We received some data! We must emit now to be sure that handshakeReceived is called
+ // since the data could have been received before the signal and slot was connected.
+ emit pTcpSocket->readyRead();
+ }
QObjectPrivate::connect(pTcpSocket, &QTcpSocket::disconnected,
this, &QWebSocketServerPrivate::onSocketDisconnected);
}