summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket_p.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.4' into 5.5Frederik Gladhorn2015-02-251-1/+6
|\ | | | | | | Change-Id: I218b5069480f60b88390c8540f01c3dbbee485d0
| * client ping should be maskedLiang Qi2015-02-241-1/+6
| | | | | | | | | | | | | | | | Task-number: QTBUG-42298 Change-Id: I4c01052823ce48b737d30ac2e0ef11836124bc4f Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Neil Williams Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* | Update copyright headersJani Heikkinen2015-02-161-6/+6
| | | | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I8467410bfad44e8d3fe6bd5724c61bb0c07c91f9 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-191-0/+2
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I6ceee770359e72a026575ea9fee51c3f97561163
| * QWebSocket should remember close code and reasonv5.4.15.4.1Frederik Gladhorn2014-12-291-0/+2
| | | | | | | | | | | | Task-number: QTBUG-42982 Change-Id: I50dbff96d7d64a5213e6ea6ba7bb9429b21b1fb2 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-211-9/+16
|\ \ | |/ | | | | Change-Id: Ifc23e46ef1623cfba93571ff03c6c62a3b2fd117
| * Merge remote-tracking branch 'origin/5.3' into 5.4Oswald Buddenhagen2014-11-031-9/+16
| |\ | | | | | | | | | Change-Id: I0e89ede5ea173f2e831c42d250ddb2b21b42b89b
| | * Make QWebSocketPrivate::makeConnections() take care of all connections.Christian Kandeler2014-11-031-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise all code that calls it has to handle the other connections separately, which is error-prone and has actually been forgotten for the case where the QWebSocket is created via upgradeFrom(). Task-number: QTBUG-39551 Change-Id: I4d1e4faa1594b53e7a8dccc9ce13ef2c323b1c61 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* | | Make the websocket handshake statefullAllan Sandfeld Jensen2014-11-191-39/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The websocket handshake could not handle being split over multiple TCP packets since it was entirely handled in on function. This patch splits it into a socket state making it possible to process over multiple incoming packaets. Change-Id: I3c45892ee6f1bb67062d561e9fbd2d7296f1208e Task-number: QTBUG-40878 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
* | | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-10-201-0/+1
|\ \ \ | |/ / | | | | | | Change-Id: I587edb09f88db76917755593bfe0cbb5c460ce96
| * | Also forward the bytesWritten(qint64) signalPeter Kümmel2014-10-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The signal bytesWritten(qint64) is part of the public API and should be emitted. Seems it was just forgotten. Change-Id: I85a56c22581c6bd3ecc504add34aeeabc76f4d2a Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* | | Fix QWebSocket's handling of query parameters with encoded charactersJuha Turunen2014-10-111-1/+1
|/ / | | | | | | | | | | | | | | | | QWebSocket used decoded version of the query part of the URL to construct the first line of the HTTP request. Task-number: QTBUG-41285 Change-Id: If16210f1b92e389dae8b1057a2d911122c31e2db Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Update license headers and add new license filesv5.4.0-alpha1Antti Kokko2014-08-241-18/+10
| | | | | | | | | | | | | | - Added LICENSE.LGPLv3, LICENSE.GPLv2 & LICENSE.LGPLv21 Change-Id: I0586e35a7aa99be1b5b3bda580b05897f451acbf Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-06-261-1/+1
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Idce64ab613c4e07ffb38cac4115690b885f110f2
| * Fix a typo in proxy handling.Jędrzej Nowacki2014-06-251-1/+1
| | | | | | | | | | | | Change-Id: I25c9b9be2c780dae32e3f634f58e44be303a4b23 Task-number: QTBUG-39568 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* | Copy the more efficient HTTP header parser from QtNetworkThiago Macieira2014-05-091-21/+46
|/ | | | | | | | | | The one from QtNetwork is more efficient, since it doesn't use regular expressions. This also solves a use of uninitialised variables. error: ‘httpStatusCode’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Change-Id: Id7f203d971564651eb0bd63d3d54d074be947793 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Fix process handshake for servers preferring lowercase http headers.Jędrzej Nowacki2014-04-091-7/+7
| | | | | | Task-number: QTBUG-37975 Change-Id: I81225a870aa92350e959b741aec34332eb8d171e Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Use the proper protocol namesSze Howe Koh2014-04-091-2/+2
| | | | | | | | - "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>
* fix compilation with QT_NO_NETWORKPROXYMaurice Kalinowski2014-03-181-1/+4
| | | | | Change-Id: Ice7ad51cbbde0ef2459642309c32dd392463754d Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* fix typo in macroMaurice Kalinowski2014-03-171-1/+1
| | | | | | Change-Id: Ib302db81e0667d0c89c1da8611639db0811ff9f3 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Return correct error string for known socket errorsKurt Pattyn2014-03-121-1/+1
| | | | | | Task-number: QTBUG-37228 Change-Id: I246b858694ea456bce9a0fc4ac963a83502fd058 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Adapt copyright headerKurt Pattyn2014-02-151-1/+1
| | | | | Change-Id: I9773492d3673d8aabdb4dd178be6af12eca7ba74 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Add user configurable mask generationKurt Pattyn2014-02-151-15/+32
| | | | | | | | | Created a QMaskGenerator abstract base class to serve as a basis for user specific mask generators. Added the possibility to override the default mask generation in QWebSocket. Change-Id: Iaa02b44193f854d103b5f352617789175fe61f89 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Fix multiple emission of received signalsKurt Pattyn2014-02-151-1/+1
| | | | | | Task-number: QTBUG-36762 Change-Id: I239bdd06252fb90056a687ace8540bb91b0055a1 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Check on newline characters in origin and urlsKurt Pattyn2014-02-111-3/+43
| | | | | | | | | | New line characters (\r\n) in the resource part of a url and in the origin string can be used to forge the http header and can lead to insertion of unwanted header entries. This can be an indication of an attack, so QWebSocket immediately refuses a connection. Change-Id: I9cdb309bfbe7025ad675925e6ea3e038476a1fd6 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Connect sslErrors signal when a secure connection is establishedKurt Pattyn2014-02-071-0/+4
| | | | | | Task-number: QTBUG-36676 Change-Id: Ia93751e5a972adf6434b0d749376e2a8c0619514 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Do not double-delete the TCP socket of a QWebSocket.Milian Wolff2014-02-061-2/+2
| | | | | | | | | | | | | The socket is put into an owning QScopedPointer. But if its also put into the QObject parent-child chain, it will get deleted when the QWebSocket is destroyed. In the dtor of the QWebSocketPrivate class m_pSocket will thus already be destroyed and thus be a dangling pointer. This crashed the QWebSocketServer test reliably for me on exit. Change-Id: I7f06e933bfed832e66b943542c351cde639c9465 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Fix assertion when encountering invalid header line.Milian Wolff2014-02-061-1/+3
| | | | | | | | | | | | | The server test sets an empty identifier which results in a headerLine containing "Server: ". The split then yields a list with a single entry ("Server"). Calling [1] on it asserts then. QFATAL : tst_QWebSocketServer::tst_connectivity() ASSERT failure in QList<T>::operator[]: "index out of range", file /ssd/milian/projects/compiled/qt5/include/QtCore/qlist.h, line 476 Change-Id: I3e5c4750b304b2a4a5669a39e2d65a6b3e4e99cf Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Do not access QObject API before its private data is initialized.Milian Wolff2014-02-061-3/+4
| | | | | | | | | | | | Inside the ctor of the private data, the QObject has not yet been associated with the data. Thus, accessing it indirectly i.e. to setup private signal/slot connections, will trigger crashes. Now we delay accessing this API and call an init() function manually in the parent QObject-inheriting class. Change-Id: I2c3ce7335c54d42af6bce87de867ee0ef197efc6 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Use QObjectPrivate instead of dedicated d-ptrKurt Pattyn2014-02-051-55/+57
| | | | | Change-Id: I3f69a2b0ca81e1e003200bb8e0a337b9532e64a0 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Allow writes only when socket is in connected stateKurt Pattyn2014-02-011-1/+1
| | | | | Change-Id: I3e265ccba334301444611a8013568ba52cca5bcd Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Adapt isValid to only return true when socket is in connected stateKurt Pattyn2014-02-011-1/+2
| | | | | | | | Changed isValid() to only return true when the socket is also in connected state. Also updated the documentation. Change-Id: Id80dbc1f28c82bef19984c5ed7b34a7d474ee011 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Set default error and errorstringKurt Pattyn2014-02-011-2/+2
| | | | | | | Set the default error and error string to match those of QAbstractSocket. Change-Id: I96277ecda1f56da4de7509a22bcab86df8064e7c Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Locally cache read buffer size and pause modeKurt Pattyn2014-02-011-10/+14
| | | | | | | | | When calling setReadBufferSize() and setPauseMode(), the internal socket is not yet created. So we cache these values and apply them when the internal socket is created. Change-Id: I4299232342438c7a6c52fa8ea4a95461b3f85ebf Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Add TODOs for improvementsKurt Pattyn2014-02-011-0/+2
| | | | | Change-Id: Ifc8cef479147de9fdd9c382ff09be21056cb3e68 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Cleanup inline commentsKurt Pattyn2014-02-011-3/+2
| | | | | Change-Id: I8d96bb2b5c1cf211de50939dc2141572750a4b70 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Remove socketOption functionalityKurt Pattyn2014-02-011-20/+0
| | | | | | | | | | Removed the setSocketOption() and socketOption(0 methods as they are not really relevant for web sockets. Also, internally for the underlying real socket the LowDelayOption and KeepAliveOption are already set. If ever needed, these methods can be added later. Change-Id: Ibfa279990c5277970eaa2dbc2dd3a7d0cce7154e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Rename write methodsKurt Pattyn2014-01-201-2/+2
| | | | | | | | | Renamed the write methods to sendTextMessage and sendBinaryMessage respectively. This makes the code more readable. Change-Id: Ie49abf07a37f54c84bd01c5c788d2e42b28bcfdd Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Remove dubious functionsKurt Pattyn2014-01-201-23/+0
| | | | | Change-Id: Ida5c46e3e42685f5e78f2aee657d12af62286810 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Rename enumerations to comply with Qt styleKurt Pattyn2014-01-181-8/+8
| | | | | Change-Id: Id72fe27cec606e7f02b8e9ac1d0d763890e86a95 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Use QString() instead of QStringLiteral("")Frederik Gladhorn2014-01-181-8/+8
| | | | | | | | | | And do the same for QByteArray. Instantiating the default constructor uses QArrayData::sharedNull() for the d-pointer which is the cheapest constructor in memory and instructions. Change-Id: I1ceaafbc0c0cb1ccc5690edba89ea1100f30b3cd Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* one if (m_mustMask) is enoughFrederik Gladhorn2014-01-181-4/+4
| | | | | Change-Id: I6cb89b981b70f10510319bfb51b77874e2a4d85a Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Add a few more const refsFrederik Gladhorn2014-01-181-9/+9
| | | | | | | | | In case of processPing we need to make a copy that potentially detaches when masking is requested, but pings are < 125 bytes. Before this code would copy the byte array in the same way much earlier. Change-Id: If0592bb4b508eeb11fdbf05c4bb98b9679ed0549 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Fix warningFrederik Gladhorn2014-01-181-1/+2
| | | | | | | | | | | warning: ignoring return value of 'qint64 QWebSocketPrivate::writeFrame(const QByteArray&)', declared with attribute warn_unused_result [-Wunused-result] For pings the result is not relevant since they are one frame only. Change-Id: Iaf958e3e1a333f8d3c0b0f9ba56f7ab58e4900f9 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Make sure that the random generator is initialized in all code pathsFrederik Gladhorn2014-01-171-3/+11
| | | | | Change-Id: Ice4826e7670cffa791250a95387ac1121ddc4089 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Limit line length to 100 characters.Kurt Pattyn2014-01-121-50/+96
| | | | | Change-Id: I9da963570b174b9a5a33e65cf144402677b4bab5 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Replace emit by Q_EMITKurt Pattyn2014-01-111-4/+4
| | | | | Change-Id: I8543a74a9b3c8c1b45d9e0e12223072b6637199b Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Remove waitXXX() methods from websocketsKurt Pattyn2014-01-111-22/+0
| | | | | | | | | | | | | The QWebSocketServer::waitForNewConnection() was just calling QTcpServer::waitForNewConnection(), which was not correct because a connection is only complete when the handshake succeeds. Waiting for the handshake to complete would need a separate thread for the handshake handling code, which would complicate the code a lot. It was decided to leave out all waitXXX() methods from the module, as it is easier to add this functionality later, then to remove it. Change-Id: I778bae45b67f81e151ad2362f772c75e9f537ff0 Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>
* Use new connect syntax in a few placesFrederik Gladhorn2014-01-091-16/+18
| | | | | Change-Id: Iff0bd801a2dc4cce9b867e9a83320d0f9a716ab3 Reviewed-by: Steven Ceuppens <steven.ceuppens@icloud.com>
* Adapt to Qt coding styleKurt Pattyn2014-01-041-125/+64
| | | | | Change-Id: I137ac180b19228e0a5683e21ca87e3fe2db9f97b Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com>