summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Handshake: Pass max header field size to the parserMårten Nordheim2022-07-051-0/+1
| | | | | | | | | | | Following e3ea1d02e6a2cbc63e8ae6fff6ccae49258fe5a2 the defaults values are a lot higher and can be externally adjusted. So, we pass our limits to the parser. Pick-to: dev 6.3 Change-Id: I712c0b59a171ee1e1f9be7879670836bff8392f7 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* Use standard macros and make move constructor inlineAllan Sandfeld Jensen2022-06-212-6/+8
| | | | | | | | Change-Id: I670fe7d2dbd7d723d554155b4a822f0f85688f4c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit b4d35eed35d0cb6617c8240b72e0dc1fe6a405b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use SPDX license identifiersLucie Gérard2022-06-1343-1562/+86
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Ief6ca28118c5ce0abe5dccf1854731cf2215e2b6 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 93eeaf4c6792c91d7932d14ba3c66131068d5789)
* Use QSslServer from QtNetwork and remove own private implementationØystein Heskestad2022-06-094-270/+34
| | | | | | | Task-number: QTBUG-100823 Pick-to: dev Change-Id: I09d855a7763d218b9dad5667c29a28cb5351e98f Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* QtWebSockets: replace qSwap with member-swap where possibleMarc Mutz2022-05-111-1/+1
| | | | | | | | | | | | | qSwap() is a monster that looks for ADL overloads of swap() and also detects the noexcept of the wrapped swap() function, so it should only be used when the argument type is unknown. In the vast majority of cases, the type is known to be efficiently std::swap()able or to have a member-swap. Call either of these. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 5.15 Change-Id: If9c28df7d788856fb1653d2fae2a68ff42a12b23 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix remaining documentation warnings and enable doc testing in CITopi Reinio2022-05-092-13/+13
| | | | | | Change-Id: If1238f62ed41fcf17cb794ffcf68a0ee3e17b030 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* wasm: Refactor to use websocket.h APILorn Potter2022-04-273-105/+185
| | | | | | | | | | | This brings better use with threads and getting rid of bind Change-Id: Ibf4bc128210fb8bbbb876d6244c48d3241c15194 Fixes: QTBUG-101682 Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
* Mark QWebSocketHandshakeOptions() move-constructor as noexceptEdward Welbourne2022-04-052-2/+2
| | | | | | | | CodeChecker says it should be so marked. Apparently this is good for performance. Change-Id: I93fc95fd61ae37fe7a8927f9fbfb593acabb74ca Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix handshake looping infinitely making no progressMårten Nordheim2022-04-011-6/+9
| | | | | | | | | | | | | | | | | | | The processHandshake function may make no progress and return. The loop calling processHandshake previously had no way of knowing this and would happily loop forever despite the outcome being the same every time. This was particularly noticeable with any response that doesn't include the \r\n\r\n sequence the first time we call processHandshake. Since processHandshake either fails or succeeds, not performing any partial-reads, we simply move it out of the loop and restructure some of the code around it. Pick-to: 6.3 6.3.0 Fixes: QTBUG-102111 Change-Id: I3955e4b90eb1be0a0ef5dfcf8a46921a086a8b49 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add support for WebSocket Sub-ProtocolsArno Rehn2022-03-3018-42/+611
| | | | | | | | | | | | | | | | | Sub-Protocol support follows RFC 6455 Sections 4.1 and 4.2. See also https://datatracker.ietf.org/doc/html/rfc6455. This patch introduces a new class QWebSocketHandshakeOptions which collects options for the WebSocket handshake. At the moment, this contains only accessors for sub-protocols. In the future, it can be extended with things like WebSocket extensions. [ChangeLog] Add support for WebSocket Sub-Protocols Fixes: QTBUG-38742 Change-Id: Ibdcef17f717f0a76caab54f65c550865df1ec78d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Revise Qt WebSockets module landing pageAndreas Eliasson2022-03-281-33/+33
| | | | | | | | | | Remove the include directive section and add the global CMake and qmake snippets. Also, reorganize some of the sections structure. Task-number: QTBUG-100369 Pick-to: 6.3 6.3.0 Change-Id: Ief7a5f845df5b2edaa17c3c652895a4adb7ad3a5 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove .prev_CMakeLists.txtKai Köhne2022-03-221-25/+0
| | | | | | Pick-to: 6.3 Change-Id: Icaf0fac81f51432c706a948d0986aae68e44fffb Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Make sure all private headers include at least one otherThiago Macieira2022-03-085-2/+5
| | | | | | | | | | See script in qtbase/util/includeprivate for the rules. Since these files are being touched anyway, I also ran the updatecopyright.pl script too. Change-Id: Ib056b47dde3341ef9a52ffff13ef677e471674b6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix order of signals around disconnectionJoni Poikelin2022-02-011-3/+1
| | | | | | | | | | | | | | | | readyRead() signal had been connected with QueuedConnection which caused disconnected() signal to sometimes come before last message signals of a connection. Reasoning for this was some issue regarding SSL sockets, but there is a good chance it has been fixed since then. Removing this doesn't seem to cause hangs now at least. Fixes: QTBUG-100054 Pick-to: 6.3 6.2 Change-Id: Id465916d111a5520f4039cf57f822918f3afbca0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Style fix: dedent closing doc tagsArno Rehn2022-01-242-17/+17
| | | | | Change-Id: Id590e49c6d80f562d29e26404285f177bd0ee840 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix setting of socket optionsJoni Poikelin2022-01-121-4/+8
| | | | | | | | Socket options need to be set after connectToHost() to take any effect. Change-Id: I006a8c59ba1c78d5edaa77d545bb0f640b7224fe Pick-to: 6.3 6.2 5.15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port QWebSocketProtocol::versionFromString() to QStringViewMarc Mutz2021-12-173-4/+5
| | | | | | | | | It's not public API, so there's no point in using QAnyStringView here. We control all callers. Pick-to: 6.3 Change-Id: I1ca9135b4fa7d435e5a21534842c002509f1b7ff Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWebSocketProtocol: fix potential UB (signed overflow) in masking operationMarc Mutz2021-12-171-1/+1
| | | | | | | | | | | | The size of the payload is a 64-bit integer, which the loop counts down. If the size is > INT_MAX, then we'll overflow the int i used to track the current position in the mask. Fix by using an unsigned integer type instead. Pick-to: 6.3 6.2 5.15 Change-Id: Ia3b8d42ae906eb03c1c7399cb1137a08121fcde3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Reuse qtbase's HTTP header parser to avoid a reinvented wheelØystein Heskestad2021-12-094-103/+68
| | | | | | Fixes: QTBUG-80700 Change-Id: I7b713fd869ac802d5eee8ebb8d90a2115365b509 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Fix typo in \qtcmakepackage commandPaul Wicking2021-10-211-1/+1
| | | | | | | | | The correct CMake package name is WebSockets Pick-to: 6.2 Fixes: QTBUG-97681 Change-Id: I434cfce2e0d7fb91534718becb953a1b94e16d16 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Reuse header http parsing code from QtNetworkØystein Heskestad2021-10-083-180/+104
| | | | | | | Fixes: QTBUG-80701 Change-Id: Ic430a7dbc4448fc6d5fc000129a8e08bbed7e77d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Correct a recently introduced typo in an \externalpage linkLuca Di Sera2021-10-051-1/+1
| | | | | | | | | | | | | | | | | | Commit bfa705a7a20576405e77be28d185c84f96c1acd0 recently modified the link to the "Talking to Yourself for Fun and Profit" paper. While the new location for the `\externalpage` link is correct, it was erroneously introduced with a typo in it. In particular, `fd` was introduced in front of the `org` domain such that the link was incorrect. The typo is now removed such as to correct the link. Task-number: QTBUG-96127 Pick-to: 6.2 Change-Id: Ie4d169a978767b77f6d59b2ef135b3a3a8a0131d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Repair broken link to a websocket paperLuca Di Sera2021-10-041-1/+1
| | | | | | | | | | | | | | | The `\externalpage` link to the "Talking to Yourself for Fun and Profit" paper, presented at the Web 2.0 Security and Privacy 2011 conference, pointed to the version hosted on the `w2spconf` domain, which is not available anymore. To repair the broken link, it was changed to point to an equivalent version stored on the `ieee-security` site. Task-number: QTBUG-96127 Pick-to: 6.2 Change-Id: Id68c5947fa285062fa69a35fa9641e88118448ba Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Migrate to autogenerated cpp exportsAlexey Edelev2021-09-272-13/+2
| | | | | | | | | Replace the hardcoded cpp exports with a generated one where it's applicable. Task-number: QTBUG-90492 Change-Id: Idc2d2d9f7ba2abbff462a27599b9a7b1aa704a4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Update \externalpage links to RFCsLuca Di Sera2021-09-171-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | The old `tools.ietf.org/html/*` web pages containing RFCs now redirect to `datatracker.ietf.org/doc/html/*`. While the redirection work, our script to catch broken links on dev-snapshots builds of the documentation doesn't handle redirection correctly, reporting it as broken. Both to appease the broken-links script and to avoid an unneccesary redirection the RFC links in `external-resourced.qdoc` were modified to point to the new domain. Furthermore, the link referring to a specific page that pointed to a section were updated to point directly to the section, so that they are consistent with other similar links. The `tools.ietf.org/id/*.txt` links, while still resolving without a redirection, were updated to use an equivalent link on the `datatracker.ietf.org` domain for consistency. Task-number: QTBUG-96127 Pick-to: 6.2 6.2.0 Change-Id: I0b937c9dbfaec0cd4b2aad5bd55fc731d073ca16 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Doc: Fix documentation warningsTopi Reinio2021-09-082-2/+2
| | | | | | | | | | * Rename a file included by QDoc to have the correct extension * Add missing \a command to mark a function argument Pick-to: 6.2 Fixes: QTBUG-96287 Change-Id: I9724b67f641ba634c91a74e3e05821f1edfeb4ad Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Use https links for tools.ietf.org linksTimofey Sartakov2021-09-073-13/+13
| | | | | | | | | | Use https links for http://tools.ietf.org links. Currenly docs seems to be available on datatracker.ietf.org domain only, and redirects set up only for https. Http links may not work, if browser does not try to use https. Change-Id: I1f656c10e7478b97ce229c48ad270338bc460d3b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Update changes doc with the singular changeAllan Sandfeld Jensen2021-08-252-0/+41
| | | | | | | | | Only the removal of the deprecated API. Pick-to: 6.2 Fixes: QTBUG-94932 Change-Id: Ib7de6b11701d4f39273eb33e75e1cc8fe2deeae3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Doc: Remove unsupported customFiltersKai Köhne2021-08-251-4/+0
| | | | | | Task-number: QTBUG-95987 Change-Id: I48eac76d28f4be45f55b1e1cb7183c7a72fe0b17 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Reinstate transitional methodsAllan Sandfeld Jensen2021-08-201-0/+6
| | | | | | | | | These were introduced in Qt5 as transitional methods, and deprecating the main methods. They should still be here to support API conversion. Pick-to: 6.2 Change-Id: I251c97dca527971bf966335288855aeea10572d2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Document new QWebSocketServer signalsKai Köhne2021-08-121-0/+41
| | | | | | | | | Note that, in contrast to QWebSocket, QWebSocketServer misses the continueInterruptedHandshake() method. Pick-to: 6.2 Change-Id: I6d38fa5a814732da40b1941decbe5cd7492bc39f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Add Changes Qt 5 to Qt 6 page to Qt WebSocketsPaul Wicking2021-08-041-0/+44
| | | | | | | | | Add a basic changes page for consistency with other modules. Task-number: QTBUG-94932 Pick-to: 6.2 Change-Id: I21428ba4bef08b4a9b50386d03c391d13f5545d0 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Remove outdated qmake pro-filesØystein Heskestad2021-07-204-77/+0
| | | | | | Task-number: QTBUG-95167 Change-Id: I32f5c1f9d3a1a7cfd1c7ceea6a887418789bc63a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Update since markersAllan Sandfeld Jensen2021-07-161-5/+5
| | | | | | | | | Qt 6.2 will be first Qt 6 release for Qt WebSockets Pick-to: 6.2 Change-Id: I2141785c3f5bf6604418e3d1b8d8c311c916400d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* CMake: Don't give plugins PUBLIC usage requirementsJoerg Bornemann2021-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | The pro2cmake.py conversion script faithfully reproduced the .pro files for the plugins, which specified the libraries as public. But in CMake, the implications of this are that public usage requirements should then be propagated to consumers. We don't expect any consumers, since a plugin is created as a MODULE library in CMake, so for Windows we don't even have an import library to link with. The only exception to this is for static builds where plugins are created as STATIC libraries instead, but only in certain controlled situations do we then link to plugins. Even then, usage requirements are not expected to propagate to the consumers, so these relationships should always be specified as private. Pick-to: 6.2 Task-number: QTBUG-90819 Change-Id: I8a7cc92826709267cc44b210c64fb3940ea20eee Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Clear frame before emitting signals to prevent duplicating messagesØystein Heskestad2021-06-251-3/+7
| | | | | | | | | [ChangeLog] Clear frame before emitting signals to prevent duplicating messages Fixes: QTBUG-87279 Pick-to: 6.2 Change-Id: Iab296f443943eeec3b2a0fbb4f79c5abb2605ca7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Pass ignoreSslErrors to unterlying QSslSocketJens Trillmann2021-06-221-0/+5
| | | | | | | | | | | | When setting ignoreSslErrors(List<QSslError>) during the sslErrors signal handling the call got ignored. Only the internal config for creating a QSslSocket would be updated but not the current QSslSocket. The request of the caller to ignore specific QSslErrors would be ignored. Pick-to: 5.12 5.15 6.2 Change-Id: I6aaea2111fe1d26e07e6eaaa7532ae1b14a187a8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix QScopedPointer usage warningsAllan Sandfeld Jensen2021-06-212-14/+9
| | | | | | | | | | Switching to std::unique_ptr since we move the data, and mark move operators noexcept. Pick-to: 6.2 Change-Id: I8548a0a2b07cb5108823a081dd1ea68e4bb1800d Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Port to new CMake API for QMLUlf Hermann2021-06-053-19/+8
| | | | | | | | | Do a purely syntactical conversion that leaves all the old code intact. Porting to declarative type registration etc shall be done in a separate step. Change-Id: I8322efe8160f2d6761817cb89d5369b15a63a952 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Clear frame on reconnectAllan Sandfeld Jensen2021-01-251-0/+1
| | | | | | | | | | | Otherwise partial data could leak through to next connection and cause odd behavior Pick-to: 5.15 Fixes: QTBUG-88923 Change-Id: I6c75e6325527379bcdca0b9819a89437d0658893 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add doc note about internal ping/pong handlingAndre Hartmann2020-12-211-0/+3
| | | | | | | Pick-to: 5.15 Change-Id: Ic74407b17d03fbfd3077ac1dd4f689a7207ccb51 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Regenerate projects to use new CMake APIAlexandru Croitor2020-12-103-6/+6
| | | | | Change-Id: Iaaa4a44c8cf8735aa17293540e701ababace8155 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove Qt5 leftoversPeter Varga2020-12-019-194/+2
| | | | | Change-Id: Ifecb6f90687601a20e719db3ba194e33f3303f24 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Replace old Q_DECL_NOEXCEPT macros with modern C++Allan Sandfeld Jensen2020-10-302-4/+4
| | | | | Change-Id: Iab7b0c45ef3e5c8c042aa906f5eb4d9142b0f6d9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use QByteArray operator of QStringDecoderAndré Klitzing2020-10-211-3/+2
| | | | | | | | | | | qwebsocketdataprocessor.cpp:203:72: error: no match for call to '(QStringDecoder) (const char*, qsizetype)' frame.payload().size()); qwebsocketdataprocessor.cpp:293:86: error: no match for call to '(QStringDecoder) (const char*, qsizetype)' closeReason = toUtf16(payload.constData() + 2, payload.size() - 2); Change-Id: Ia56b7b0b6e184ed95abf105d22149b4e07f18551 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Update dependencies on 'dev' in qt/qtwebsocketsAllan Sandfeld Jensen2020-09-211-1/+1
| | | | | Change-Id: I2f5660c165dbdc504c66ec8d04ab97c349b197fd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix compilation by replacing QStringRef with QStringViewMarcel Krems2020-08-201-1/+1
| | | | | Change-Id: I3f34797df1fbf25be03c4d548d8d59df68794f1e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix build against latest qtbaseMaurice Kalinowski2020-08-182-0/+2
| | | | | Change-Id: Ibeb6f1a596cb93e2c2f5dd841cd568dea9e637d8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Change return type from QMap to QMultiMapMarcel Krems2020-08-102-2/+2
| | | | | | | | | QMultiMap no longer inherits QMap which causes the conversion to fail: error C2440: 'return': cannot convert from 'const QMultiMap<QString,QString>' to 'QMap<QString,QString>' Change-Id: Ie9c0b2588d0b0c27a81949926b36800f6f6c354c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove 'nolink' hack for WebSocketsTopi Reinio2020-07-021-21/+0
| | | | | | | | | | | This was used for preventing unwanted auto-links. We have since introduced a different mechanism to handle these (the 'ignorewords' qdocconf variable), and this workaround now causes problems. Pick-to: 5.15 Fixes: QTBUG-85388 Change-Id: Ife6183accf46a3b47f2dc6c988e40cf8f9f24e49 Reviewed-by: Paul Wicking <paul.wicking@qt.io>