summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket_p.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make sure child QObjects get moved-to-thread along with the ownerMårten Nordheim2020-05-181-17/+16
| | | | | | | | | | | | | | | | By parenting them. And to do that without crashing they need to be allocated dynamically. A couple missed "parenting"s caused the object to not be moved to the other thread when the websocket was moved. This caused it to print warnings when the timer was started and stopped since this cannot be done across threads. Fixes: QTBUG-83722 Change-Id: Iee60fe1c498f8f6d1e0c2cfcb2923bd5b9560acb Reviewed-by: Jesus Fernandez <jsfdez@gmail.com> (cherry picked from commit 393fcf8a64748f0c59f47d254667518dba9e2fc3) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* 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-191-6/+83
| | | | | | | | | | | | | 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-021-2/+1
| | | | | | | | 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>
* Change QMap to QMultiMapMårten Nordheim2020-01-231-2/+2
| | | | | | | 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-141-6/+2
|\ | | | | | | Change-Id: Icd1a2fd565d5d85ac6d1378578a92dbb1a9692ce
| * 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>
* | Fix websocket handshake request header parsingFranck Dude2019-12-131-1/+5
|/ | | | | | | | | | | 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>
* 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-281-2/+2
| | | | | | | | | | | | 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-271-2/+2
|\ | | | | | | Change-Id: I2eaffbe6e9519a78d0f8663c0870f24cb006d222
| * Remove waitForReadyRead from QWebSocketFrame::readFrameRyan Chu2019-08-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Use QElapsedTimer instead of QTime for the ping timerFriedemann Kleint2019-08-231-0/+2
|/ | | | | | | | | 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>
* wasm: fix validity statev5.13.0-beta1Lorn Potter2019-03-111-0/+2
| | | | | | | Fixes:QTBUG-73689 Change-Id: I5993eb38a8fc45a06a8ced46f71034e4b87ec67b 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>
* Add support for WebSockets on Qt for WASMLorn Potter2018-09-201-0/+8
| | | | | | | | | Implement the QWebSocket API using HTML WebSocket. Change-Id: I2284f8606d512943d2abc2a96fc48effcc45a786 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Remove unnecesary default labelJesus Fernandez2018-08-141-2/+0
| | | | | | Change-Id: I994b34614b2e2ee95fed145e7f5dcd873ff7c3f4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix conversion warningsJesus Fernandez2018-08-141-8/+12
| | | | | | Change-Id: I087b72412db19f34b8e890ddc6a3a0fcdd434141 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use QObjectPrivate::q_ptr instead of shadowing itJesus Fernandez2018-08-141-9/+6
| | | | | | | | | | Some private classes had a q_ptr pointer shadowing the QObjectPrivate::q_ptr pointer. Q_Q casts the QObjectPrivate::q_ptr pointer to match the public class so there is no need to store a different pointer. Change-Id: I8f5c4323b1dcf45a9796c0dd9f522bdbc63add18 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-3/+7
|\ | | | | | | Change-Id: Iffe66da51d3b7b38d04ca3c185b3b003b157f886
| * Limit Close frame to 125 bytesMårten Nordheim2018-08-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | All control frames should be limited to 125 frames. https://tools.ietf.org/html/rfc6455#section-5.5 Task-number: QTBUG-62949 Change-Id: Id9b5a431faab6ff6edf7dc2e5c3525e999bc04ea Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
* | Use QUrl::toString() when forming the 'Host' headerTimur Pocheptsov2018-05-161-10/+12
|/ | | | | | | | | | This allows to correctly use IPv6 literals and also deals (correctly) with a port (if it's set at all). Task-number: QTBUG-68245 Change-Id: I6d29543887c4ab58d70f0970a6f0a1b822c301df Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWebSocket: fix bytesWritten being emitted twiceMårten Nordheim2018-04-181-2/+0
| | | | | | | | Because it was connect-ed twice. Task-number: QTBUG-67778 Change-Id: Ia19d2471c148c615faceb7548566d819683c2193 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make HTTP header parsing RFC-compliantRobert Griebl2017-11-281-7/+23
| | | | | | | | | | | All this home-grown parsing should be replaced with code from the qhttp* classes. This would result in a big refactoring though, so this commit at least tries to make the header parsing RFC compliant and not choke on perfectly legal "Header:Value" messages. Change-Id: I14303610dc7187b8d8595568fb221c18e4e0d515 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-201-0/+3
|\ | | | | | | | | | | | | | | Conflicts: src/websockets/qwebsocket_p.cpp tests/auto/websockets/qwebsocketserver/tst_qwebsocketserver.cpp Change-Id: I40922fab198a09a3fbba1b2f11b42f2d40e53720
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-301-0/+3
| |\ | | | | | | | | | Change-Id: I3ae5df71f201cfdb9a4c9e7d90a60d1f9792700a
| | * Fix empty sslConfiguration in sslErrors slotAndré Klitzing2017-10-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If QWebSocket fires signal sslErrors the QSslConfiguration of QWebSocket is not updated. So client application cannot check it in implemented slot. Fix this by calling the update method like for encrypted signal. Sibling of QTBUG-40401. Change-Id: I18b39f6b6a0791ae67fc2bff5cf2c04a22b0ab85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Replace typedefs by QOverloadAndré Klitzing2017-10-301-6/+3
| | | | | | | | | | | | | | | | | | Change-Id: I509332fa23bcf2cf2e6c10b7edacb4157f025ff9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-10-111-3/+4
|\ \ \ | |/ / | | | | | | | | | | | | | | | Conflicts: examples/websockets/simplechat/chatserver.cpp Change-Id: I98697cef4c05516b5b4122ad81c084546d57115f
| * | Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta3v5.10.0-beta2Liang Qi2017-10-111-2/+3
| |\ \ | | |/ | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I4af142703e469b56236b73335a93f6960534c0f1
| | * Change assert to null-checkMårten Nordheim2017-09-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Avoids a crash that would happen if readyRead was emitted after calling ::close on the websocket. Task-number: QTBUG-59179 Change-Id: I1e7bd19d99ee068b8699014fac9a72f839632c85 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| | * Fix releaseConnectionsAlan Alpert2017-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The overload selected when you pass a single object pointer is to disconnect all signals with that object as a receiver. We want to disconnect all signals with that object as a sender, which is done most easily by passing no explicit arguments. Task-number: QTBUG-62667 Change-Id: I3dd9c5aced9160510bff527355ecfbedded690aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Romain Pokrzywka <romain.pokrzywka@gmail.com> Reviewed-by: Liang Qi <liang.qi@qt.io>
| * | Use multi-arg instead of multiple arg callsAndré Klitzing2017-10-091-1/+1
| |/ | | | | | | | | | | Change-Id: Ic1f4b357138457eb33ac9154a280f499664c3c78 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Replace Q_NULLPTR with nullptrKevin Funk2017-09-261-4/+4
|/ | | | | Change-Id: I0988a4119b5bd790d286c16b5647d97d4d95aef0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace comment with Q_FALLTHROUGHJesus Fernandez2017-05-041-3/+3
| | | | | Change-Id: Ie970ce470672f1c849470b0eaf7fe39758341e37 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-09-211-10/+6
|\ | | | | | | | | | | | | Conflicts: src/websockets/qwebsocket_p.cpp Change-Id: Ib6b9655985246c9ce3968f1eb662be457465a937
| * Eradicate Q_FOREACH and Java-style loops and mark the module as Q_FOREACH-freeMarc Mutz2016-09-071-11/+8
| | | | | | | | | | | | Change-Id: I200f72423f13b54c636e995b120a70968b0e0758 Reviewed-by: Milian Wolff <milian.wolff@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Eradicate Q_FOREACH loopsAndré Klitzing2016-08-231-1/+2
|/ | | | | Change-Id: I08541a4162ceb4ba101ed44d65143dda6eb84e3d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-021-1/+1
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I593c47e7aeebb7997f42a7408a8d22704d2713a1
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-1/+1
| |\ | | | | | | | | | Change-Id: Ie37e1ec038e82c845066f92e5f87e355d627e2ff
| | * Fixed erroneous detection of server disconnect conditionOleksandr Tymoshenko2016-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractSocket::atEnd does not check actual connection state it only checks if data is ready to be read. Under some conditions (e.g. slow network) data may not be available yet but it doesn't mean the server dropped connection. When more data comes FSM will pick it up and handle as expected. The right way to check disconnect is to check for actual socket state. Task-number: QTBUG-51069 Change-Id: I17d7110fbefdba2d5378a71935ab5923f8c1bf3e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add support for TLS PSK (client and server)André Klitzing2016-06-121-0/+3
| | | | | | | | | | | | | | | | | | | | | [ChangeLog][QWebSocket] It is now possible to use TLS PSK ciphersuites. Change-Id: I9e96669494cec5e6a4e076fe9f10fcd4ef6358a4 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-081-2/+24
|\ \ \ | |/ / | | | | | | Change-Id: I8a2d6875b68c99786f99ec0dc380f8725c6abd42
| * | Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-beta1Liang Qi2016-04-081-2/+24
| |\ \ | | |/ | | | | | | Change-Id: I7ebcdc16a8b65103abfb9640c990eddbeccdef05
| | * Fix possible hang on handshakeKai Koehne2016-04-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | processHandShake operates on complete lines. If the data available does not contain the full handshake message, the loop will therefore never return. Task-number: QTBUG-51001 Change-Id: Ie87f5b5dee01116f463e84f06feab502ff5ac563 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| | * Update the QWebSocket's QSslConfiguration when neededAndy Shaw2016-03-101-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | This ensures that the peer certificate chain is kept in sync so that it can be queried when an encrypted connection has been made. Change-Id: I5df18bb71ac4bec3a8a939482df5a5ffe5c20cb5 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* | | Remove unused variableFrank Meerkoetter2016-04-071-3/+1
| | | | | | | | | | | | | | | Change-Id: I0ffeb96bfab3543f94501bf1605bb6c899ef466f Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>