summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-04-11 14:17:49 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-04-11 14:17:49 +0200
commitf78a7049271e59238acfcad58fb4f7183d92cd1f (patch)
treeb87d1bf5a7a16a126a5d07e629aae591e1d27e4f /src
parent258d019df60bc346a6fa89da694e52c4743dc18b (diff)
parent8b9836d0e00736b5a16f650667218612940e106b (diff)
downloadqtwebsockets-f78a7049271e59238acfcad58fb4f7183d92cd1f.tar.gz
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Iff68a7da2065b64579032f1be8eaf5fb097d58bb
Diffstat (limited to 'src')
-rw-r--r--src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp2
-rw-r--r--src/imports/qmlwebsockets/qmlwebsockets_plugin.h2
-rw-r--r--src/websockets/qdefaultmaskgenerator_p.cpp4
-rw-r--r--src/websockets/qwebsocket.cpp16
-rw-r--r--src/websockets/qwebsocket_p.cpp18
-rw-r--r--src/websockets/qwebsocketdataprocessor.cpp2
-rw-r--r--src/websockets/qwebsocketframe.cpp4
-rw-r--r--src/websockets/qwebsocketprotocol.cpp4
-rw-r--r--src/websockets/qwebsocketserver.cpp22
-rw-r--r--src/websockets/qwebsocketserver_p.cpp4
10 files changed, 39 insertions, 39 deletions
diff --git a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
index d407196..a36aeac 100644
--- a/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
+++ b/src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
-void QmlWebsocket_plugin::registerTypes(const char *uri)
+void QmlWebSocket_plugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("Qt.WebSockets"));
diff --git a/src/imports/qmlwebsockets/qmlwebsockets_plugin.h b/src/imports/qmlwebsockets/qmlwebsockets_plugin.h
index cd663a5..1cab587 100644
--- a/src/imports/qmlwebsockets/qmlwebsockets_plugin.h
+++ b/src/imports/qmlwebsockets/qmlwebsockets_plugin.h
@@ -48,7 +48,7 @@
QT_BEGIN_NAMESPACE
-class QmlWebsocket_plugin : public QQmlExtensionPlugin
+class QmlWebSocket_plugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
diff --git a/src/websockets/qdefaultmaskgenerator_p.cpp b/src/websockets/qdefaultmaskgenerator_p.cpp
index da166ac..32b3309 100644
--- a/src/websockets/qdefaultmaskgenerator_p.cpp
+++ b/src/websockets/qdefaultmaskgenerator_p.cpp
@@ -90,7 +90,7 @@ QDefaultMaskGenerator::~QDefaultMaskGenerator()
\internal
*/
-bool QDefaultMaskGenerator::seed()
+bool QDefaultMaskGenerator::seed() Q_DECL_NOEXCEPT
{
qsrand(static_cast<uint>(QDateTime::currentMSecsSinceEpoch()));
return true;
@@ -101,7 +101,7 @@ bool QDefaultMaskGenerator::seed()
\internal
*/
-quint32 QDefaultMaskGenerator::nextMask()
+quint32 QDefaultMaskGenerator::nextMask() Q_DECL_NOEXCEPT
{
return quint32((double(qrand()) / RAND_MAX) * std::numeric_limits<quint32>::max());
}
diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp
index 825d66c..f53d3d7 100644
--- a/src/websockets/qwebsocket.cpp
+++ b/src/websockets/qwebsocket.cpp
@@ -43,7 +43,7 @@
\class QWebSocket
\inmodule QtWebSockets
- \brief Implements a TCP socket that talks the websocket protocol.
+ \brief Implements a TCP socket that talks the WebSocket protocol.
WebSockets is a web technology providing full-duplex communications channels over
a single TCP connection.
@@ -60,9 +60,9 @@
QWebSocket only supports version 13 of the WebSocket protocol, as outlined in
\l {http://tools.ietf.org/html/rfc6455}{RFC 6455}.
- \note Some proxies do not understand certain HTTP headers used during a web socket handshake.
- In that case, non-secure web socket connections fail. The best way to mitigate against
- this problem is to use web sockets over a secure connection.
+ \note Some proxies do not understand certain HTTP headers used during a WebSocket handshake.
+ In that case, non-secure WebSocket connections fail. The best way to mitigate against
+ this problem is to use WebSocket over a secure connection.
\warning To generate masks, this implementation of WebSockets uses the cryptographically
insecure qrand() function.
@@ -81,11 +81,11 @@
/*!
\page echoclient.html example
\title QWebSocket client example
- \brief A sample websocket client that sends a message and displays the message that
+ \brief A sample WebSocket client that sends a message and displays the message that
it receives back.
\section1 Description
- The EchoClient example implements a web socket client that sends a message to a websocket server
+ The EchoClient example implements a WebSocket client that sends a message to a WebSocket server
and dumps the answer that it gets back.
This example should ideally be used with the EchoServer example.
\section1 Code
@@ -166,7 +166,7 @@ not been filled in with new information when the signal returns.
This signal is emitted every time a payload of data has been written to the socket.
The \a bytes argument is set to the number of bytes that were written in this payload.
- \note This signal has the same meaning both for secure and non-secure websockets.
+ \note This signal has the same meaning both for secure and non-secure WebSockets.
As opposed to QSslSocket, bytesWritten() is only emitted when encrypted data is effectively
written (see QSslSocket::encryptedBytesWritten()).
\sa close()
@@ -388,7 +388,7 @@ void QWebSocket::close(QWebSocketProtocol::CloseCode closeCode, const QString &r
}
/*!
- \brief Opens a websocket connection using the given \a url.
+ \brief Opens a WebSocket connection using the given \a url.
If the url contains newline characters (\\r\\n), then the error signal will be emitted
with QAbstractSocket::ConnectionRefusedError as error type.
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index fb6486e..18962ff 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -440,7 +440,7 @@ void QWebSocketPrivate::open(const QUrl &url, bool mask)
}
} else {
const QString message =
- QWebSocket::tr("Unsupported websockets scheme: %1").arg(url.scheme());
+ QWebSocket::tr("Unsupported WebSocket scheme: %1").arg(url.scheme());
setErrorString(message);
Q_EMIT q->error(QAbstractSocket::UnsupportedSocketOperationError);
}
@@ -463,7 +463,7 @@ void QWebSocketPrivate::ping(const QByteArray &payload)
/*!
\internal
- Sets the version to use for the websocket protocol;
+ Sets the version to use for the WebSocket protocol;
this must be set before the socket is opened.
*/
void QWebSocketPrivate::setVersion(QWebSocketProtocol::Version version)
@@ -887,21 +887,21 @@ void QWebSocketPrivate::processHandshake(QTcpSocket *pSocket)
const QStringList headerField = headerLine.split(QStringLiteral(": "),
QString::SkipEmptyParts);
if (headerField.size() == 2) {
- headers.insertMulti(headerField[0], headerField[1]);
+ headers.insertMulti(headerField[0].toLower(), headerField[1]);
}
headerLine = readLine(pSocket);
}
- const QString acceptKey = headers.value(QStringLiteral("Sec-WebSocket-Accept"),
+ const QString acceptKey = headers.value(QStringLiteral("sec-websocket-accept"),
QString());
- const QString upgrade = headers.value(QStringLiteral("Upgrade"), QString());
- const QString connection = headers.value(QStringLiteral("Connection"), QString());
+ const QString upgrade = headers.value(QStringLiteral("upgrade"), QString());
+ const QString connection = headers.value(QStringLiteral("connection"), QString());
// unused for the moment
-// const QString extensions = headers.value(QStringLiteral("Sec-WebSocket-Extensions"),
+// const QString extensions = headers.value(QStringLiteral("sec-websocket-extensions"),
// QString());
-// const QString protocol = headers.value(QStringLiteral("Sec-WebSocket-Protocol"),
+// const QString protocol = headers.value(QStringLiteral("sec-websocket-protocol"),
// QString());
- const QString version = headers.value(QStringLiteral("Sec-WebSocket-Version"),
+ const QString version = headers.value(QStringLiteral("sec-websocket-version"),
QString());
if (Q_LIKELY(httpStatusCode == 101)) {
diff --git a/src/websockets/qwebsocketdataprocessor.cpp b/src/websockets/qwebsocketdataprocessor.cpp
index db9aa88..83a1a26 100644
--- a/src/websockets/qwebsocketdataprocessor.cpp
+++ b/src/websockets/qwebsocketdataprocessor.cpp
@@ -41,7 +41,7 @@
/*!
\class QWebSocketDataProcessor
The class QWebSocketDataProcessor is responsible for reading, validating and
- interpreting data from a websocket.
+ interpreting data from a WebSocket.
It reads data from a QIODevice, validates it against RFC 6455, and parses it into
frames (data, control).
It emits signals that correspond to the type of the frame: textFrameReceived(),
diff --git a/src/websockets/qwebsocketframe.cpp b/src/websockets/qwebsocketframe.cpp
index 431710c..e48308f 100644
--- a/src/websockets/qwebsocketframe.cpp
+++ b/src/websockets/qwebsocketframe.cpp
@@ -42,7 +42,7 @@
/*!
\class QWebSocketFrame
The class QWebSocketFrame is responsible for reading, validating and
- interpreting frames from a websocket.
+ interpreting frames from a WebSocket.
It reads data from a QIODevice, validates it against RFC 6455, and parses it into a
frame (data, control).
Whenever an error is detected, isValid() returns false.
@@ -336,7 +336,7 @@ QWebSocketFrame QWebSocketFrame::readFrame(QIODevice *pIoDevice)
switch (processingState) {
case PS_WAIT_FOR_MORE_DATA:
//TODO: waitForReadyRead should really be changed
- //now, when a websocket is used in a GUI thread
+ //now, when a WebSocket is used in a GUI thread
//the GUI will hang for at most 5 seconds
//maybe, a QStateMachine should be used
if (!pIoDevice->waitForReadyRead(5000)) {
diff --git a/src/websockets/qwebsocketprotocol.cpp b/src/websockets/qwebsocketprotocol.cpp
index a5e45c4..46a84ec 100644
--- a/src/websockets/qwebsocketprotocol.cpp
+++ b/src/websockets/qwebsocketprotocol.cpp
@@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtWebSockets
- \brief The different defined versions of the Websocket protocol.
+ \brief The different defined versions of the WebSocket protocol.
For an overview of the differences between the different protocols, see
<http://code.google.com/p/pywebsocket/wiki/WebSocketProtocolSpec>
@@ -162,7 +162,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn QWebSocketProtocol::isCloseCodeValid(int closeCode)
- Checks if \a closeCode is a valid web socket close code
+ Checks if \a closeCode is a valid WebSocket close code
\internal
*/
diff --git a/src/websockets/qwebsocketserver.cpp b/src/websockets/qwebsocketserver.cpp
index 58c3cc9..20aa009 100644
--- a/src/websockets/qwebsocketserver.cpp
+++ b/src/websockets/qwebsocketserver.cpp
@@ -44,11 +44,11 @@
\inmodule QtWebSockets
- \brief Implements a websocket-based server.
+ \brief Implements a WebSocket-based server.
It is modeled after QTcpServer, and behaves the same. So, if you know how to use QTcpServer,
you know how to use QWebSocketServer.
- This class makes it possible to accept incoming websocket connections.
+ This class makes it possible to accept incoming WebSocket connections.
You can specify the port or have QWebSocketServer pick one automatically.
You can listen on a specific address or on all the machine's addresses.
Call listen() to have the server listen for incoming connections.
@@ -72,9 +72,9 @@
\note When working with self-signed certificates, FireFox currently has a
\l {https://bugzilla.mozilla.org/show_bug.cgi?id=594502} {bug} that prevents it to
- connect to a secure websocket server. To work around this problem, first browse to the
- secure websocket server using https. FireFox will indicate that the certificate is invalid.
- From here on, the certificate can be added to the exceptions. After this, the secure websockets
+ connect to a secure WebSocket server. To work around this problem, first browse to the
+ secure WebSocket server using HTTPS. FireFox will indicate that the certificate is invalid.
+ From here on, the certificate can be added to the exceptions. After this, the secure WebSockets
connection should work.
QWebSocketServer only supports version 13 of the WebSocket protocol, as outlined in RFC 6455.
@@ -85,10 +85,10 @@
/*!
\page echoserver.html example
\title WebSocket server example
- \brief A sample websocket server echoing back messages sent to it.
+ \brief A sample WebSocket server echoing back messages sent to it.
\section1 Description
- The echoserver example implements a web socket server that echoes back everything that is sent
+ The echoserver example implements a WebSocket server that echoes back everything that is sent
to it.
\section1 Code
We start by creating a QWebSocketServer (`new QWebSocketServer()`). After the creation, we listen
@@ -96,7 +96,7 @@
\snippet echoserver/echoserver.cpp constructor
If listening is successful, we connect the `newConnection()` signal to the slot
`onNewConnection()`.
- The `newConnection()` signal will be thrown whenever a new web socket client is connected to our
+ The `newConnection()` signal will be thrown whenever a new WebSocket client is connected to our
server.
\snippet echoserver/echoserver.cpp onNewConnection
@@ -128,7 +128,7 @@
/*!
\fn void QWebSocketServer::serverError(QWebSocketProtocol::CloseCode closeCode)
- This signal is emitted when an error occurs during the setup of a web socket connection.
+ This signal is emitted when an error occurs during the setup of a WebSocket connection.
The \a closeCode parameter describes the type of error that occurred
\sa errorString()
@@ -503,7 +503,7 @@ quint16 QWebSocketServer::serverPort() const
QWebSocketServer will emit the error() signal with
the QWebSocketProtocol::CloseCodeAbnormalDisconnection close code
when the maximum of connections has been reached.
- The websocket handshake will fail and the socket will be closed.
+ The WebSocket handshake will fail and the socket will be closed.
\sa maxPendingConnections(), hasPendingConnections()
*/
@@ -543,7 +543,7 @@ int QWebSocketServer::socketDescriptor() const
}
/*!
- Returns a list of websocket versions that this server is supporting.
+ Returns a list of WebSocket versions that this server is supporting.
*/
QList<QWebSocketProtocol::Version> QWebSocketServer::supportedVersions() const
{
diff --git a/src/websockets/qwebsocketserver_p.cpp b/src/websockets/qwebsocketserver_p.cpp
index f349dc2..70bc5da 100644
--- a/src/websockets/qwebsocketserver_p.cpp
+++ b/src/websockets/qwebsocketserver_p.cpp
@@ -435,7 +435,7 @@ void QWebSocketServerPrivate::handshakeReceived()
pTcpSocket->close();
pTcpSocket->deleteLater();
qWarning() << QWebSocketServer::tr("Too many pending connections: " \
- "New websocket connection not accepted.");
+ "New WebSocket connection not accepted.");
setError(QWebSocketProtocol::CloseCodeAbnormalDisconnection,
QWebSocketServer::tr("Too many pending connections."));
return;
@@ -471,7 +471,7 @@ void QWebSocketServerPrivate::handshakeReceived()
success = true;
} else {
setError(QWebSocketProtocol::CloseCodeAbnormalDisconnection,
- QWebSocketServer::tr("Upgrading to websocket failed."));
+ QWebSocketServer::tr("Upgrade to WebSocket failed."));
}
}
else {