summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QAbstractSocket: Fix warnings from deprecated error signalv5.15.0-beta4v5.15.0-beta3Mårten Nordheim2020-03-231-2/+1
| | | | | | Task-number: QTBUG-82605 Change-Id: Ibaa722ae26a71680426cecc3a0e25acc72d9527b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add a public api to set max frame and message size (CVE-2018-21035)Franck Dude2020-03-198-10/+285
| | | | | | | | | | | | | This change allows the user to set a lower allowed frame/message size for reception. The purpose is to avoid an attacker to exhaust the virtual memory of the peer. Fixes CVE-2018-21035 [ChangeLog] Added public API to set the maximum frame size and message size Task-number: QTBUG-70693 Change-Id: I5dc5918badc99166afdcc8d9c6106247a9f8666f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-022-8/+6
| | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: If65be10a7c86e7b4173fd31f1d277c63c6accb0a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Revert "QWebSocket - do not use deprecated member-function"Allan Sandfeld Jensen2020-02-271-1/+1
| | | | | | | | | This reverts commit 938ad6373415fa8b0767a987c37ce51ec546859f. Reason for revert: Was undeprecated and replacement removed Change-Id: I79d6e931d72ec518a43fe058e1067b3754f6cf05 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* WebSocketServer: Add Q_(UN)LIKELYAndre Hartmann2020-02-261-6/+6
| | | | | | | | ... to optimize code that is used for error handling. Change-Id: I62fe11d34d32c6784e960505fccbf529a3265d23 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update plugins.qmltypes for 5.15Jani Heikkinen2020-02-251-1/+1
| | | | | | Task-number: QTBUG-82253 Change-Id: I90199c05f683df18dffe796227fc8e4c0ef9f72d Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-251-2/+3
|\ | | | | | | Change-Id: I69ac9d8a828ba664e38b1f5abdfd0830f55c134e
| * Doc: fix missing closing commentAndre Hartmann2020-02-241-0/+1
| | | | | | | | | | Change-Id: I2e1f4893b1b4c1270630101c390b937611e5d5e2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| * Doc: fix links to autobahn testsuiteAndre Hartmann2020-02-241-2/+2
| | | | | | | | | | | | Fixes: QTBUG-69425 Change-Id: I28e03da927c7a9b1cbfb91a0aca32866c2e653ea Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* | Change QMap to QMultiMapMårten Nordheim2020-01-234-6/+6
| | | | | | | | | | | | | | Because insertMulti is deprecated Change-Id: I3965ea7159b2516b35c45072115eba1ab621b89a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | QWebSocket - do not use deprecated member-functionTimur Pocheptsov2020-01-151-1/+1
| | | | | | | | | | | | | | | | Use 'socketError' instead. Task-number: QTBUG-80369 Change-Id: I30527721677be0fc0f71ca33b08f608472bc8b71 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-142-7/+2
|\ \ | |/ | | | | Change-Id: Icd1a2fd565d5d85ac6d1378578a92dbb1a9692ce
| * Remove extra deleteLater (already done in onSocketDisconnected)Franck Dude2019-12-131-1/+0
| | | | | | | | | | Change-Id: I671d93ccd766fed4fff797930804ab748cbb27a1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * Don't add port in Host header unless specifiedLander Noterman2019-11-211-6/+2
| | | | | | | | | | | | | | | | | | | | | | No longer add port to Host header in WebSocket handshake unless it was explicitly specified in the URL. This change fixes issues with some WebSocket servers rejecting the connection if the Host header does not match the URL. Fixes: QTBUG-77526 Change-Id: I9b028ce434416e61cae7b217d2eafe621d2660b4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Add protection against handshake header too largeFranck Dude2019-12-131-1/+9
| | | | | | | | | | | | Task-number: QTBUG-70691 Change-Id: I54b9f7157e5830b9efd8bae7d4777218857249b1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Fix websocket handshake request header parsingFranck Dude2019-12-133-8/+33
| | | | | | | | | | | | | | | | | | | | | | Header ends with \r\n\r\n but there might be more data inside the tcpbuffer Never read past the header Task-number: QTBUG-70000 Change-Id: If3d4cb362646e43a91faf00f89e50510ff00fa56 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Cleanup QWebSocketFrameChristian Ehrlicher2019-11-262-147/+15
|/ | | | | | | | | | | Remove QWebSocketFrame assignment and move stuff by our own - the default ones are good. Also reorder the members to reduce the padding (56 to 48 bytes on 64bits). Change-Id: Ib4628628af924c36ad3cd9bf67ce72752ef97ff5 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove broken documentation commentsTopi Reinio2019-11-111-25/+0
| | | | | | | | | | | | | QWebSocketServer::nativeDescriptor() and its setter were documented twice, with the duplicated versions under Qt6-specific version check macro and marked \deprecated. QDoc still parses those in Qt5 as it doesn't respect the version guards - remove the offending comments for now. Fixes: QTBUG-79816 Change-Id: Ie40190c9d32f91efd3428b7f884c9ad923a2bb0e Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Update plugins.qmltypes for 5.14Kai Koehne2019-10-221-1/+1
| | | | | | | Task-number: QTBUG-78690 Change-Id: Ie1de2c3cf46edca2b1441ff94a9bb50cb507c057 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add support for chrono versions of handshakeTimeout functionsv5.14.0-beta2Mårten Nordheim2019-10-092-4/+34
| | | | | | | | | | | | | And rename the int-version of the getter to enable the scenario where someone does not have chrono. From the 5.14 API change review. Amends 2e54dbe86eac61e87782a138dbcc158cb6b10cd9 Change-Id: Icf2f2a3aebc2216defd0a3a569544c4270ddf05a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-171-4/+12
|\ | | | | | | Change-Id: I4052a4c238a0c59b1a0fc01ad3fd6ee6b714595b
| * wasm: make sendBinaryMessage work in threaded modeMorten Johan Sørvig2019-09-131-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two issues in sendBinaryMessage(), one observed, and one theoretical: 1) WebSocket send() does not accept data views backed by SharedArrayBuffer, which is the case for heap memory views when threading is enabled. 2) We have no way of observing for how long send() will retain the memory view passed to it. This means we don’t know when the QByteArray can be safely freed. Both can be solved by copying the payload data to a separate ArrayBuffer, whose lifetime can be managed by WebSocket. Fixes: QTBUG-78078 Change-Id: I73209080db66f38b971f2c8a727b43402357b1a9 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | Add missing \since 5.14 to new APIMårten Nordheim2019-08-301-0/+2
| | | | | | | | | | | | | | | | | | | | From API review. Amends 2e54dbe86eac61e87782a138dbcc158cb6b10cd9 Change-Id: Ie55a3ef076e042e4461397996e19bf7d397c3fb5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* | Take 2: Properly handle multiple websocket frames in one TCP frameMårten Nordheim2019-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Gerrit ate my change and somehow created an impossible state where a patch was able to merge due to its fix but couldn't actually pass its tests. Amends 6e1fa958c289de639753a60a9384bd94db0e91a8 Task-number: QTBUG-77830 Change-Id: Iedc23616816bb2c1758969a1d76b9536b509c38a Reviewed-by: Ryan Chu <ryan.chu@qt.io> Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* | QWebsocket doesn't receive message with size larger than 1MRyan Chu2019-08-283-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | If the processing of QWebSocketFrame is not done and waiting for more data, QWebSocketPrivate::processData should return the control and wait for next readyRead signal. Continue the change of b2fc794ffaf48c9d9c401b54cf39ea0220617a27 Change-Id: Idf5af0710267e59e63b8e234d6dab5843d821696 Reviewed-by: Jesus Fernandez <jsfdez@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge dev into 5.14Kari Oikarinen2019-08-275-192/+225
|\ \ | | | | | | | | | Change-Id: I2eaffbe6e9519a78d0f8663c0870f24cb006d222
| * | Remove waitForReadyRead from QWebSocketFrame::readFrameRyan Chu2019-08-235-36/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Asynchronously process socket frame in QWebSocketDataProcessor::process. If the processing of QWebSocketFrame is not done and waiting for more data, QWebSocketDataProcessor::process will return the control and wait for next readyRead signal to continue processing the unfinished socket frame. QWebSocketDataProcessor::process gets timeout after 5 seconds, and then an errorEncountered signal will be emitted. Fixes: QTBUG-74464 Change-Id: I03b7f874c1c266617e7eadf59c59ae43fa8540ce Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * | Make QWebSocketFrame::readFrame as a non-static public functionRyan Chu2019-08-234-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The static function QWebSocketFrame::readFrame used to return a parsed QWebSocketFrame read from QIODevice. This change make QWebSocketFrame reusable. It will base on its internal state and keep processing the incoming data from QIODevice. Change-Id: Ic6dea59529fa935cdb8034519e633ea67e869674 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | Add an internal state to keep the processing state of frame readingRyan Chu2019-08-232-52/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The macro 'WAIT_FOR_MORE_DATA' is revised because the processing state is kept by m_processingState. Remove the unused dataWaitSize and returnState local variables from QWebSocketFrame::readFrame. Change-Id: I8e270c5c7117b170159d4fb3b2bf1531a9cd5334 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * | Divide QWebSocketFrame::readFrame into subroutinesRyan Chu2019-08-232-142/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To reduce the dependency of each state and remove local variables (bytesRead, hasMask, and payloadLength) from QWebSocketFrame::readFrame, this change breaks down the states of QWebSocketFrame::readFrame into subroutines. In this change, it uses a readFramePayloadLength function to handle PS_READ_PAYLOAD_LENGTH and PS_READ_BIG_PAYLOAD_LENGTH cases. In addition, a missing error-handling is added in the read-header case if the bytesAvailable is less than 2 bytes. The variable hasMask is replaced by transiently using m_mask to indicate whether to read a mask. After reading mask in readFrameMask, the transient value will be over-written and used in readFramePayload. To replace local variable payloadLength with QWebSocketFrame::m_length, m_length is expanded to hold the payload length. Change-Id: I1c2d197112cef5cea75215923fa28e6f2e6cbef8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Use QElapsedTimer instead of QTime for the ping timerFriedemann Kleint2019-08-232-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The use of QTime for determining intervals is deprecated: qwebsocket_p.cpp:1214:61: warning: ‘int QTime::elapsed() const’ is deprecated: Use QElapsedTimer instead [-Wdeprecated-declarations] Change-Id: I26e1dabcba5ba54a4fead02b43c3fe7ace740be0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Prospective fix for compilation with WebAssembly/MinGW73Friedemann Kleint2019-08-221-3/+6
|/ / | | | | | | | | | | | | | | | | | | Pass a template argument to std::less/greater. Amends 54ffd0d0a3bf2c77d53e1cdfe04b362f59682cb4. Fixes: QTBUG-77500 Change-Id: I0b78906090d8b0e3c910104975c08ff79ba9fc12 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-07-161-0/+1
|\ \ | |/ | | | | Change-Id: Ifa55b6563a15a91d7906d9e84936c4484323f809
| * Doc: Replace example file lists with links to code.qt.ioTopi Reinio2019-07-091-0/+1
| | | | | | | | | | | | Task-number: QTBUG-74391 Change-Id: I4f5a70c7439b27db2b02907e460b5804d5c6e104 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-06-291-3/+5
|\ \ | |/ | | | | Change-Id: I2a1987a687fafb73b3b8368db93bcca7a91bb5d0
| * Doc: Complete parameter description several methodsNico Vertriest2019-06-181-3/+5
| | | | | | | | | | Change-Id: Ib9f98683faf2b3a4041371c80a31de1f0902261d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Fix deprecation warnings in QWebSocketHandshakeResponse::getHandshakeResponse()Friedemann Kleint2019-05-271-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings: websockethandshakeresponse.cpp:151:46: warning: ‘QSet<T> QList<T>::toSet() const [with T = QString]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:151:84: warning: ‘QSet<T> QList<T>::toSet() const [with T = QString]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:151:94: warning: ‘QList<T> QSet<T>::toList() const [with T = QString]’ is deprecated: Use values() instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:155:47: warning: ‘QSet<T> QList<T>::toSet() const [with T = QString]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:155:86: warning: ‘QSet<T> QList<T>::toSet() const [with T = QString]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:155:96: warning: ‘QList<T> QSet<T>::toList() const [with T = QString]’ is deprecated: Use values() instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:157:46: warning: ‘QSet<T> QList<T>::toSet() const [with T = QWebSocketProtocol::Version]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:157:82: warning: ‘QSet<T> QList<T>::toSet() const [with T = QWebSocketProtocol::Version]’ is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations] qwebsockethandshakeresponse.cpp:157:92: warning: ‘QList<T> QSet<T>::toList() const [with T = QWebSocketProtocol::Version]’ is deprecated: Use values() instead. [-Wdeprecated-declarations] by replacing them with a helper function to created a list intersection. Change-Id: Iee37632517760133ceebae4eda394170293f25c3 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | websocket server: add timeout to abort incomplete handshakesHeiko Voigt2019-04-296-5/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A websocket connection can involve two types of handshakes. First an optional SSL handshake and second the websocket handshake itself. Either one can get stalled/stuck if the other side does not answer. To be robust by default and for easy mitigation by users of websockets let's introduce a handshake timeout. We introduce a default timeout of 10 seconds which can be customized by the newly introduced setHandshakeTimeout() method. One major location where connections got stuck was when the connection queue was filled with connections waiting for the SSL handshake. Only connections that have finished this handshake can be processed anyway so we now add them to the queue once they are fully ready to start the websocket handshake. Task-number: QTBUG-63312 Task-number: QTBUG-57026 Change-Id: Ia286221f1d8da1000e98973496280fde16ed811d Reviewed-by: Alf Crüger <a.crueger@baxi-innotech.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-135-9/+12
|\ \ | |/ | | | | Change-Id: I43320389826b0f0deac412bf37df9232f2e68a33
| * Automatically register the latest import versionv5.13.0-beta3Kai Koehne2019-04-125-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | This follows what was done in d28c9f6a for Qt Quick Controls 2. The latest import version (e.g. 1.14 in Qt 5.14) will automatically be registered whenever the Qt version is bumped. This avoids needing to wait until a new type is added (or a new revision is added to an existing type) before being able to use the newest Qt Quick version. Change-Id: I3a2232d5f7418ec99441a71fb70d88835dc61a61 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-191-1/+1
|\ \ | |/ | | | | Change-Id: Ic2ff163b19d51fae2c9f2f53c5c046912ab2bc62
| * Update plugins.qmltypes for Qt 5.13Kai Koehne2019-03-181-1/+1
| | | | | | | | | | | | Task-number: QTBUG-73739 Change-Id: Ia7aad40aa100b168b9cf2aae511473ce88820a41 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-122-0/+8
|\ \ | |/ | | | | Change-Id: I8c230768cbb0727da162e504cf18bcc05a43c3dd
| * wasm: fix validity statev5.13.0-beta1Lorn Potter2019-03-112-0/+8
| | | | | | | | | | | | | | Fixes:QTBUG-73689 Change-Id: I5993eb38a8fc45a06a8ced46f71034e4b87ec67b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Don't use internal members of QObjectLars Knoll2019-02-111-5/+8
|/ | | | | | | | And compile again after those got changed in qtbase. Fixes: QTBUG-73728 Change-Id: Ibcd6af650ed1ceb4f9218a49e9a3c2ca466018bb Reviewed-by: Liang Qi <liang.qi@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2019-01-052-1/+5
|\ | | | | | | Change-Id: Ia08fda4945ea3fd0b7b13f6f65963c7b4fa31468
| * wasm: set and update socket stateLorn Potter2019-01-042-1/+5
| | | | | | | | | | | | | | Fixes: QTBUG-72664 Change-Id: I8bd90f8676835d8f7bec135ad3e6c6b3e9cd9d9a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Set the protocol type so that PAC scripts handle ws/wss correctlyAndy Shaw2018-12-261-0/+2
| | | | | | | | | | | | | | | | | | On macOS it will only allow proxies in a PAC script to use http/https protocols, so this enables them to work by automatically setting these as the type instead. Change-Id: I66589057d40d135229cbae4986ef0819287ea69a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | Remove unneeded CRLF ending from status lineAleksey Lysenko2018-12-211-1/+1
| | | | | | | | | | | | | | | | | | No need to keep the CRLF ending of status line. Task-number: QTBUG-67424 Change-Id: I7f94c7bedf40412b338c56cfe59751f6a9e78f0a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-10-025-139/+98
|\ \ | |/ | | | | Change-Id: I297fa8021bd7520851d139c16b97671d41156919