summaryrefslogtreecommitdiff
path: root/tests/auto/websockets
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Regenerate projects after mergewip/cmakeAlexandru Croitor2020-03-236-18/+6
| | | | | | Change-Id: I3cdf755e3aae933016b9719ce4c61f53e554ea48 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2020-03-232-17/+17
|\ | | | | | | | | | | | | Conflicts: dependencies.yaml Change-Id: I1608720522e974c7107f00599a9fb70f17865189
| * Stabilize tst_QWebSocketServer::tst_handshakeTimeoutv5.15.0-beta2Mårten Nordheim2020-03-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | The test was a bit flaky which seems to have been due to the short timeout. Increase the timeout a considerable amount, it doesn't matter much to the runtime anyway: the test still takes around 5 seconds to finish. Fixes: QTBUG-82559 Change-Id: Ie14ea204de1cc7ac2951144099d5be88adebef04 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Stop forcing deprecated ssl protocol versionMårten Nordheim2020-01-171-1/+0
| | | | | | | | | | Change-Id: I422a2498bb940f801484d3f2e6e5d59edd637514 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Cleanup QWebSocketFrameChristian Ehrlicher2019-11-261-15/+11
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Regenerate projectsAlexandru Croitor2019-11-159-11/+11
| | | | | | | | | | | | Change-Id: Ie454c70664c94743c0323d3d5fb8d4d7f224f3f1 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-154-12/+112
|\ \ | |/ | | | | | | | | Removed dependencies.yaml. Change-Id: Ie799709d6a94054ca937c70a73fd979efb9619f7
| * Add support for chrono versions of handshakeTimeout functionsv5.14.0-beta2Mårten Nordheim2019-10-091-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * 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-273-12/+72
| |\ | | | | | | | | | Change-Id: I2eaffbe6e9519a78d0f8663c0870f24cb006d222
| | * Add the missing tests in tst_DataProcessor::frameTooSmallRyan Chu2019-08-231-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are missing tests of 'text frame with final bit not set'. After dataProcessor.process, the spied signals should be compared and cleared before processing next frame. Change-Id: I5737da9d57e0043cfedb400f4e0934c5ce7c4250 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>
| | * Remove waitForReadyRead from QWebSocketFrame::readFrameRyan Chu2019-08-232-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-231-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Properly handle multiple websocket frames in one TCP frameMårten Nordheim2019-08-261-0/+28
| |/ | | | | | | | | | | | | | | | | | | | | Since we can have multiple websocket frames in one TCP frame we need to handle them all. Partial revert of b14f5f59a3ae96949e6a33302385a751d6448182 Fixes: QTBUG-77830 Change-Id: If435f6e67f04e4817a3202eb8fe779243591bff3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Regenerate before mergeAlexandru Croitor2019-10-156-0/+30
| | | | | | | | | | Change-Id: I9f22f5d050aeec3e8c308e286a897f0f524ed8e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add initial-support for cmakeMaurice Kalinowski2019-09-1610-0/+190
|/ | | | | | | Task-number: QTBUG-78180 Change-Id: If6cf82c61d605332402feffca9bde2ea0dd6e313 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Investigate tst_handshakeTimeout test flakinessMårten Nordheim2019-06-271-11/+25
| | | | | | | | | | | | | | | Remove "localhost" in favor of "127.0.0.1" to avoid any name resolution. And wait 5 seconds for all websockets to timeout together, while printing how many have not timed-out in case of failure. Credits to Mårten Nordheim for coding this. With this patch, I can not reproduce the flakiness any longer. Lets see if this is also the case in our CI. Fixes: QTBUG-76572 Change-Id: Ibdbafbd7786c87138bdc84ebc690177211f23f5b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix compilation error when configured without SSLDimitrios Apostolou2019-06-031-0/+1
| | | | | | | | | | | | QTcpSocket definition is apparently indirectly included when compiling with SSL support enabled, but without it the compiler outputs error. Change-Id: I5f4d8978ef04442443e934ee28e949a49a9f5b18 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_QWebSocketServer: Fix deprecation warnings about ↵Friedemann Kleint2019-05-271-1/+1
| | | | | | | | | QSslSocket::supportedCiphers() Replace by QSslConfiguration::supportedCiphers(). Change-Id: Ia5ce3e399272127304ea7e93ba32627df5864381 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* websocket server: add timeout to abort incomplete handshakesHeiko Voigt2019-04-291-14/+154
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* tst_qwebsocketserver: force TLS 1.2 for the PSK testMårten Nordheim2018-11-051-0/+5
| | | | | | | | | When using TLS 1.3 the psk callback is called on the start of a connection. Force TLS 1.2 to avoid this. Task-number: QTBUG-71560 Change-Id: I97df3a9d2f100d10b4a1d2e8d0e4696688ec66ac Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix implicit conversion warningJesus Fernandez2018-08-201-0/+13
| | | | | | | | | | | | | 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-179-9/+9
| | | | | Change-Id: Ic7ce11f1631197e6ee019b66c0d7ec56590c5ab5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use nullptr instead of 0Jesus Fernandez2018-08-102-2/+2
| | | | | | Change-Id: Ibad1bbb351d14ab0de140875d2969b7da483eb21 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-0/+29
|\ | | | | | | Change-Id: Iffe66da51d3b7b38d04ca3c185b3b003b157f886
| * Limit Close frame to 125 bytesMårten Nordheim2018-08-061-0/+29
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-031-1/+2
|\ \ | |/ | | | | Change-Id: Ieb9c874a99c519c7871dda3c437e6f3a66ba440c
| * Migrate tst_handshakeresponse to QRegularExpressionSamuel Gaist2018-06-301-1/+2
| | | | | | | | | | | | | | | | | | This patch updates the tst_handshakeresponse test to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: I98febd0565351b644dd68b98d356764bee78d7c5 Reviewed-by: Liang Qi <liang.qi@qt.io>
* | QWebSocket: Add 'bytesToWrite'Mårten Nordheim2018-04-142-0/+16
|/ | | | | | | | | | | | | | | | Add the well-known 'bytesToWrite' function to QWebSocket. Previously the only way to know how many bytes were left to be written was to make a guesstimate on the overhead your message would get and then keep track of the amount sent using the 'bytesWritten' signal. The tests compare using '>' because there is overhead from the headers. [ChangeLog][QWebSocket] Added the bytesToWrite function to QWebSocket. Call this function to see how many bytes are left to write. Change-Id: I82f17a98b582ee3bc02f0c47597b4a6717761f12 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make HTTP header parsing RFC-compliantRobert Griebl2017-11-281-0/+40
| | | | | | | | | | | 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-33/+24
|\ | | | | | | | | | | | | | | 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-34/+24
| |\ | | | | | | | | | Change-Id: I3ae5df71f201cfdb9a4c9e7d90a60d1f9792700a
| | * Fix empty sslConfiguration in sslErrors slotAndré Klitzing2017-10-271-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * Check count of spy to verify signalAndré Klitzing2017-10-271-31/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like QVERIFY(spy.wait()) is a little bit flaky. We should check the count of the spy if it was successful instead of the return value of wait since wait will return false even if the signal was delivered before the call to wait(). Change-Id: I5f9031685dfa69b00155fa22602bab998843cb68 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>
* | | Replace typedefs by QOverloadAndré Klitzing2017-10-301-2/+1
| | | | | | | | | | | | | | | | | | Change-Id: I509332fa23bcf2cf2e6c10b7edacb4157f025ff9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | test: fix tst_QWebSocket::tst_moveToThread()Liang Qi2017-10-261-2/+2
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-63707 Change-Id: Iaba78256f790bc422790a03fccb841e6e6482fc1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | Replace Q_NULLPTR with nullptrKevin Funk2017-09-261-1/+1
|/ / | | | | | | | | Change-Id: I0988a4119b5bd790d286c16b5647d97d4d95aef0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Enable tests for boot2qtSami Nurmenniemi2017-07-193-4/+57
|/ | | | | | | | | | | | | Websocket tests for boot2qt were disabled with commit 1a75da8d514c90cf1af250ba3eaa764df4838775. The tests can be enabled since qtdeclarative now fallbacks to software renderer if OpenGL is not supported. Qemu still has missing syscall support so some tests need to be skipped if that condition is detected. Change-Id: I39dba91cb35cc17a9a9263c90a739cbf95efa582 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disable/blacklist failing tests for boot2qtSami Nurmenniemi2017-05-091-0/+3
| | | | | | | | | Currently boot2qt is tested with QEMU and some tests fail. Disabling them for now to make it possible to enable qt5 tests for Coin. Task-number: QTBUG-60266 Change-Id: Ib93153c857c1645c189db1bd69951cc29acfdccf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a function to hand off a tcp socket to the websocket serverAleksey Lysenko2017-01-271-0/+34
| | | | | | | | | | | | | This method allows a listening port to process connections with different protocols. It lets the websocket server handle a TCP socket, upgrading it to a websocket [ChangeLog][QWebSocketServer] Add support to handle external QTcpSocket Done-with: André Klitzing <aklitzing@gmail.com> Task-number: QTBUG-54276 Change-Id: Ia36b481dc87d6f3806e9f1e61e75e528640f1937 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix the parser of port in hand shake requestLiang Qi2017-01-061-0/+103
| | | | | | | | | | Use QUrl::setAuthority() to parse host and port. The request is invalid when having username or password in Host. Task-number: QTBUG-57357 Change-Id: I4e7c0370794dce15359d372a1e36dc0383083204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed possible block clearing in QWebSocketDataProcessor::process methodAleksey Lysenko2017-01-041-8/+46
| | | | | | | | | | | | | In QWebSocketDataProcessor::process() the signals text(binary)MessageReceived are emitted before clear() method. If signal handler blocks loop (for example, using QDialog::exec()), clear() will be called only after resuming loop. It may lead to the data corruption due to the fact that QWebSocketDataProcessor clearing won't be performed before the new data arrived. Task-number: QTBUG-55506 Change-Id: Ib7016a91d3987dec7c1af977b17f86a53568c413 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fixed wrong scheme for secure websocketAleksey Lysenko2016-12-165-0/+109
| | | | | | | | | | Websocket server always constructed QWebSocketHandshakeRequest like for non-secure socket without checking SecureMode. This led to the fact that secure socket had "ws" scheme. Task-number: QTBUG-55927 Change-Id: I881766f55182136072fd23f3fefe93ea60f3d27d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Clean up QT_CONFIG usageLars Knoll2016-08-197-7/+7
| | | | | | | Use the newer qtConfig() method instead. Change-Id: I197dbe01edaf8696ee06d30400bd18e53cf69c94 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Add support for TLS PSK (client and server)André Klitzing2016-06-121-0/+127
| | | | | | | [ChangeLog][QWebSocket] It is now possible to use TLS PSK ciphersuites. Change-Id: I9e96669494cec5e6a4e076fe9f10fcd4ef6358a4 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Updated license headersAntti Kokko2016-01-209-153/+108
| | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I191cd4111d18052fbe80bbe21bf851bf4795a1a6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Test: replace obsolete QUrl::addQueryItem()Liang Qi2015-10-211-1/+3
| | | | | Change-Id: I266b98d309a8912efb988a4c7a006d6fefb48531 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2015-10-204-21/+192
|\ | | | | | | Change-Id: I8d2c4b0982623839b880a9d8fbe7f5ee69d33ad3
| * Test: replace obsolete QChar::fromAscii()Liang Qi2015-10-201-2/+2
| | | | | | | | | | | | Change-Id: Ib41421e87af66d6ba9248b66e713e452d226143d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-10-201-1/+1
| |\ | | | | | | | | | Change-Id: I7b56e21fa93d0d196887e8dfa683050f3a032186