summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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
| * wasm: refactor and convert from EM_ASMv5.12.0-beta4v5.12.0-beta3v5.12.0-beta2v5.12.0-beta1Lorn Potter2018-10-012-137/+94
| | | | | | | | | | | | | | | | | | | | This also has the benefit that binary data is no longer accessed via a global. Change-Id: I2db744696fe88ca03f55897016d9d38e302f820b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * Update plugins.qmltypesKai Koehne2018-09-273-2/+4
| | | | | | | | | | | | | | | | | | | | | | Add an empty dependencies.json to avoid the implicit QtQuick dependency. Task-number: QTBUG-70264 Change-Id: I67b0f8cee04d3cd255c9df3c9bc7caf79ffdf9a9 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | Use fully-qualified QQmlWebSocket::StatusAndré Klitzing2018-09-241-1/+1
| | | | | | | | | | | | | | | | Found by clazy Change-Id: I0d5acebcc1ced28fe4a2f659a1017a33d2e47f79 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-09-223-0/+245
|\ \ | |/ | | | | Change-Id: Ie28fec3c7ddd160b29529841db55a79ae7bc53df
| * Add support for WebSockets on Qt for WASMLorn Potter2018-09-203-0/+245
| | | | | | | | | | | | | | | | | | 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>
* | Fix detection of the end of HTTP request headersAleksey Lysenko2018-08-291-1/+3
|/ | | | | | | | | Implemented relying only on \r\n\r\n at the end to be sure that HTTP request is fully received. Task-number: QTBUG-70000 Change-Id: I388dca2ce9ef57ef4f4d7a9b6bc22c47ffe42235 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix implicit conversion warningJesus Fernandez2018-08-202-3/+107
| | | | | | | | | | | | | Marks the old functions as deprecated and adds new safe versions.The new functions give access to the native descriptor safely. It also fixes the original functions in Qt 6. warning: implicit conversion loses integer precision: 'qintptr' (aka 'long long') to 'int' Change-Id: I59177905af0181912d2e7824ce68265cb8ee03d9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove redundant options and a stray defineJesus Fernandez2018-08-172-4/+2
| | | | | Change-Id: Ic7ce11f1631197e6ee019b66c0d7ec56590c5ab5 Reviewed-by: Edward Welbourne <edward.welbourne@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-143-10/+14
| | | | | | 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-146-37/+25
| | | | | | | | | | 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>
* Use nullptr instead of 0Jesus Fernandez2018-08-101-1/+1
| | | | | | Change-Id: Ibad1bbb351d14ab0de140875d2969b7da483eb21 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use override keywordJesus Fernandez2018-08-1011-18/+18
| | | | | Change-Id: I120dcb26eb451930d02e452cc47262eda44cc77c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix C-style castJesus Fernandez2018-08-101-3/+3
| | | | | | Change-Id: I9e2b2ff177aa921f7f86319de4a229c1a8a4c410 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-072-4/+11
|\ | | | | | | Change-Id: Iffe66da51d3b7b38d04ca3c185b3b003b157f886
| * Limit Close frame to 125 bytesMårten Nordheim2018-08-062-4/+11
| | | | | | | | | | | | | | | | | | | | | | 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>