Use the proper protocol names
authorSze Howe Koh <szehowe.koh@gmail.com>
Wed, 2 Apr 2014 12:18:13 +0000 (20:18 +0800)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 9 Apr 2014 02:01:17 +0000 (04:01 +0200)
- "WebSocket" is one word, with uppercase 'W' and 'S'.
- "HTTP"/"HTTPS" is fully uppercase

Change-Id: Ice3a50c94394433c97f7347291af5cda69b234ce
Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
18 files changed:
examples/websockets/doc/echoclient.qdoc
examples/websockets/doc/echoserver.qdoc
examples/websockets/doc/simplechat.qdoc
examples/websockets/echoclient/echoclient.cpp
examples/websockets/echoserver/echoclient.html
examples/websockets/simplechat/chatclient.html
examples/websockets/sslechoclient/sslechoclient.cpp
examples/websockets/sslechoserver/sslechoclient.html
src/imports/qmlwebsockets/qmlwebsockets_plugin.cpp
src/imports/qmlwebsockets/qmlwebsockets_plugin.h
src/websockets/qwebsocket.cpp
src/websockets/qwebsocket_p.cpp
src/websockets/qwebsocketdataprocessor.cpp
src/websockets/qwebsocketframe.cpp
src/websockets/qwebsocketprotocol.cpp
src/websockets/qwebsocketserver.cpp
src/websockets/qwebsocketserver_p.cpp
tests/auto/handshakerequest/tst_handshakerequest.cpp

index a6cb1a9..2c64169 100644 (file)
@@ -43,9 +43,9 @@
     \example echoclient
     \title Echo Client Example
     \ingroup qtwebsockets-examples
-    \brief Describes how to use the websocket API for creating a simple echo client.
+    \brief Describes how to use the WebSocket API for creating a simple echo client.
 
-    The Echo Client Example shows how to use the websocket API to create a simple
+    The Echo Client Example shows how to use the WebSocket API to create a simple
     echo client.
 
     \sa {Echo Server Example}
index fcb0442..ca020bf 100644 (file)
@@ -47,7 +47,7 @@
     sends back the messages it receives.
 
     The Echo Server Example shows how to create a simple server application that
-    sends back the messages it receives, using the websockets API.
+    sends back the messages it receives, using the WebSocket API.
 
     \sa {Echo Client Example}
 */
index 506d45a..13591a0 100644 (file)
@@ -44,9 +44,9 @@
     \title Simple Chat Example
     \ingroup qtwebsockets-examples
     \brief Shows how to use the QWebSocket and QWebSocketServer classes
-    for creating a minimalistic chat application over websockets.
+    for creating a minimalistic chat application over the WebSocket protocol.
 
     The Simple Chat Example shows how to use the QWebSocket and QWebSocketServer
-    classes to create a minimalistic chat application over websockets.
+    classes to create a minimalistic chat application over the WebSocket protocol.
 
 */
index 9e8ba9b..142a81e 100644 (file)
@@ -57,7 +57,7 @@ EchoClient::EchoClient(const QUrl &url, QObject *parent) :
 //! [onConnected]
 void EchoClient::onConnected()
 {
-    qDebug() << "Websocket connected";
+    qDebug() << "WebSocket connected";
     connect(&m_webSocket, &QWebSocket::textMessageReceived,
             this, &EchoClient::onTextMessageReceived);
     m_webSocket.sendTextMessage(QStringLiteral("Hello, world!"));
index e9c55dc..1edfb64 100644 (file)
@@ -1,12 +1,12 @@
 <html>
     <head>
-        <title>Websocket Echo Client</title>
+        <title>WebSocket Echo Client</title>
     </head>
     <body>
-        <h1>Websocket Echo Client</h1>
+        <h1>WebSocket Echo Client</h1>
         <p>
-            <button onClick="initWebsocket();">Connect</button>
-            <button onClick="stopWebsocket();">Disconnect</button>
+            <button onClick="initWebSocket();">Connect</button>
+            <button onClick="stopWebSocket();">Disconnect</button>
             <button onClick="checkSocket();">State</button>
         </p>
         <p>
@@ -37,7 +37,7 @@
             var wsUri = "ws://localhost:1234";
             var websocket = null;
 
-            function initWebsocket() {
+            function initWebSocket() {
                 try {
                     if (typeof MozWebSocket == 'function')
                         WebSocket = MozWebSocket;
@@ -62,7 +62,7 @@
                 }
             }
 
-            function stopWebsocket() {
+            function stopWebSocket() {
                 if (websocket)
                     websocket.close();
             }
@@ -92,9 +92,9 @@
                             break;
                         }
                     }
-                    debug("Websocket state = " + websocket.readyState + " ( " + stateStr + " )");
+                    debug("WebSocket state = " + websocket.readyState + " ( " + stateStr + " )");
                 } else {
-                    debug("Websocket is null");
+                    debug("WebSocket is null");
                 }
             }
         </script>
index 5b077f7..511d05b 100644 (file)
@@ -1,12 +1,12 @@
 <html>
     <head>
-        <title>Websocket Chat Client</title>
+        <title>WebSocket Chat Client</title>
     </head>
     <body>
-        <h1>Websocket Chat Client</h1>
+        <h1>WebSocket Chat Client</h1>
         <p>
-            <button onClick="initWebsocket();">Connect</button>
-            <button onClick="stopWebsocket();">Disconnect</button>
+            <button onClick="initWebSocket();">Connect</button>
+            <button onClick="stopWebSocket();">Disconnect</button>
             <button onClick="checkSocket();">State</button>
         </p>
         <p>
@@ -41,7 +41,7 @@
             var wsUri = "ws://localhost:1234";
             var websocket = null;
 
-            function initWebsocket() {
+            function initWebSocket() {
                 try {
                     if (typeof MozWebSocket == 'function')
                         WebSocket = MozWebSocket;
@@ -66,7 +66,7 @@
                 }
             }
 
-            function stopWebsocket() {
+            function stopWebSocket() {
                 if (websocket)
                     websocket.close();
             }
@@ -96,9 +96,9 @@
                             break;
                         }
                     }
-                    debug("Websocket state = " + websocket.readyState + " ( " + stateStr + " )");
+                    debug("WebSocket state = " + websocket.readyState + " ( " + stateStr + " )");
                 } else {
-                    debug("Websocket is null");
+                    debug("WebSocket is null");
                 }
             }
         </script>
index 037990d..2300da2 100644 (file)
@@ -61,7 +61,7 @@ SslEchoClient::SslEchoClient(const QUrl &url, QObject *parent) :
 //! [onConnected]
 void SslEchoClient::onConnected()
 {
-    qDebug() << "Websocket connected";
+    qDebug() << "WebSocket connected";
     connect(&m_webSocket, &QWebSocket::textMessageReceived,
             this, &SslEchoClient::onTextMessageReceived);
     m_webSocket.sendTextMessage(QStringLiteral("Hello, world!"));
index b9faa44..7ecb147 100644 (file)
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <html>
     <head>
-        <title>Websocket Echo Client</title>
+        <title>WebSocket Echo Client</title>
         <meta charset="utf-8">
     </head>
     <body>
-        <h1>Websocket Echo Client</h1>
+        <h1>WebSocket Echo Client</h1>
         <p>
-            <button onClick="initWebsocket();">Connect</button>
-            <button onClick="stopWebsocket();">Disconnect</button>
+            <button onClick="initWebSocket();">Connect</button>
+            <button onClick="stopWebSocket();">Disconnect</button>
             <button onClick="checkSocket();">State</button>
         </p>
         <p>
@@ -39,7 +39,7 @@
                 }
             }
 
-            function initWebsocket() {
+            function initWebSocket() {
                 try {
                     if (typeof MozWebSocket == 'function')
                         WebSocket = MozWebSocket;
@@ -64,7 +64,7 @@
                 }
             }
 
-            function stopWebsocket() {
+            function stopWebSocket() {
                 if (websocket)
                     websocket.close();
             }
@@ -94,9 +94,9 @@
                             break;
                         }
                     }
-                    debug("Websocket state = " + websocket.readyState + " ( " + stateStr + " )");
+                    debug("WebSocket state = " + websocket.readyState + " ( " + stateStr + " )");
                 } else {
-                    debug("Websocket is null");
+                    debug("WebSocket is null");
                 }
             }
         </script>
index d407196..a36aeac 100644 (file)
@@ -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"));
 
index cd663a5..1cab587 100644 (file)
@@ -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")
index 825d66c..f53d3d7 100644 (file)
@@ -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.
 /*!
     \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.
index fb6486e..7555eca 100644 (file)
@@ -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)
index db9aa88..83a1a26 100644 (file)
@@ -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(),
index 431710c..e48308f 100644 (file)
@@ -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)) {
index a5e45c4..46a84ec 100644 (file)
@@ -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
 */
index 58c3cc9..20aa009 100644 (file)
 
     \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.
 /*!
   \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
 
 /*!
     \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
 {
index f349dc2..de3d04d 100644 (file)
@@ -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;
index 4302e13..e4dbf05 100644 (file)
@@ -159,14 +159,14 @@ void tst_HandshakeRequest::tst_invalidStream_data()
     //this test checks if there doesn't occur an out-of-bounds exception
     QTest::newRow("Correctly formatted but invalid short fields") << QStringLiteral("V R P");
     QTest::newRow("Invalid \\0 character in header") << QStringLiteral("V R\0 P");
-    QTest::newRow("Invalid http version in header") << QStringLiteral("V R HTTP/invalid");
+    QTest::newRow("Invalid HTTP version in header") << QStringLiteral("V R HTTP/invalid");
     QTest::newRow("Empty header field") << QStringLiteral("GET . HTTP/1.1\r\nHEADER: ");
     QTest::newRow("All zeros") << QString::fromUtf8(QByteArray(10, char(0)));
     QTest::newRow("Invalid hostname") << QStringLiteral("GET . HTTP/1.1\r\nHost: \xFF\xFF");
     //doing extensive QStringLiteral concatenations here, because
     //MSVC 2010 complains when using concatenation literal strings about
     //concatenation of wide and narrow strings (error C2308)
-    QTest::newRow("Complete header - Invalid websocket version")
+    QTest::newRow("Complete header - Invalid WebSocket version")
             << QStringLiteral("GET . HTTP/1.1\r\nHost: foo\r\nSec-WebSocket-Version: ") +
                QStringLiteral("\xFF\xFF\r\n") +
                QStringLiteral("Sec-WebSocket-Key: AVDFBDDFF\r\n") +
@@ -177,7 +177,7 @@ void tst_HandshakeRequest::tst_invalidStream_data()
                QStringLiteral("Sec-WebSocket-Key: AVDFBDDFF\r\n") +
                QStringLiteral("Upgrade: websocket\r\n") +
                QStringLiteral("Connection: Upgrade\r\n\r\n");
-    QTest::newRow("Complete header - Invalid http version")
+    QTest::newRow("Complete header - Invalid HTTP version")
             << QStringLiteral("GET . HTTP/a.1\r\nHost: foo\r\nSec-WebSocket-Version: 13\r\n") +
                QStringLiteral("Sec-WebSocket-Key: AVDFBDDFF\r\n") +
                QStringLiteral("Upgrade: websocket\r\n") +