summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add a public api to set max frame and message size (CVE-2018-21035)Franck Dude2020-03-192-3/+89
| | | | | | | | | | | | | 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>
* Revert "Speculatively increase timeouts in tst_qwebsocket"Timur Pocheptsov2020-03-191-5/+5
| | | | | | | | | This reverts commit 8c4b6d212c72b8bb59bc687cbc35bbdebe112434. Reason for revert: It didn't fix the issue Change-Id: I11490a968746255e6f7fd906cddcc3ee36ca6201 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Speculatively increase timeouts in tst_qwebsocketMårten Nordheim2020-03-181-5/+5
| | | | | | | In case it's causing these recent failures. Change-Id: Icdedab57e2e46d332bf1ae9c1d4869a2ed480d94 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-301-0/+6021
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ic89c6250fae297177b4990de302b4bde71709216
| * Add binary compatibility file for qtwebsockets 5.14 branchMilla Pohjanheimo2019-12-161-0/+6021
| | | | | | | | | | | | | | BC file built against 5.14.0 added. Change-Id: Ib72e1fd443bf88cec944ab451edcc43ca070a135 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* 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>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-09-031-0/+5977
|\ | | | | | | Change-Id: I9c23395dfda8bfaf308dacbf17c471b62803371c
| * Binary compatibility file against Qt5.13.0 for QtWebSocketsMilla Pohjanheimo2019-08-261-0/+5977
| | | | | | | | | | | | | | BC file added. Change-Id: Ibc33a9a55c8dc378938046cb3c45c1464864e348 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* | 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>
* | 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>
* Add binary comaptibility file for QtWebSockets for Qt 5.12Milla Pohjanheimo2018-12-181-0/+5602
| | | | | | | Binary compatibility file added. Change-Id: I3a7c598cc47fb243325881c089857ec8955dd67c Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-11-241-0/+5
|\ | | | | | | Change-Id: I8cd45ab778b95b7d444b06940fd7b4ddc83a599b
| * tst_qwebsocketserver: force TLS 1.2 for the PSK testMårten Nordheim2018-11-231-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> (cherry picked from commit 7022a1f7e8f703815022bc7d0956da54f9f7a3c1)
* | 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-1711-16/+11
| | | | | | | | | | Change-Id: Ic7ce11f1631197e6ee019b66c0d7ec56590c5ab5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Refactor manual testJesus Fernandez2018-08-161-89/+47
| | | | | | | | | | | | | | | | | | | | Rewrite a manual test to be data-driven, rather than clumsily recursive. Modernise and tidy the code in the process. Change-Id: I11919adf1bceaec831b8573bd1194fb2ab15297d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Use nullptr instead of 0Jesus Fernandez2018-08-141-1/+1
| | | | | | | | | | | | Change-Id: Ia3610779a2006d9027a1c4427a968e13cfc28cbe Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> 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>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-06-121-0/+5472
|\ \ | |/ | | | | Change-Id: Iec795a4f7ca2fdf632b0fca57b81e1da41893e96
| * Add binary compatibility file for 5.11 for QtWebSocketsMilla Pohjanheimo2018-06-051-0/+5472
| | | | | | | | | | | | | | File for bic test added. Change-Id: I6b1a221f1bc2465f0bd1c323a534ecf22869a7da Reviewed-by: Lars Knoll <lars.knoll@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>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-202-1/+5473
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ic66a4cabbe0a2af1fa59ae33026a236437434a85
| * Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-01-181-1/+1
| |\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I4a88ddf6722f4b29512fbec71f3d055591e625ba
| | * Fix apparently invalid auto-test (qmlwebsockets)Timur Pocheptsov2017-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It makes sense to first start listening (server.listen = true) and then connect (socket.active = true). Task-number: QTBUG-59388 Change-Id: I4235dad87ee3a62ebf75cec39e5d9fa4b7ed7552 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Add binary compatibility file for QtWebSockets for 5.10Milla Pohjanheimo2018-01-091-0/+5472
| | | | | | | | | | | | | | | | | | | | | | | | File to test binary compatibility for 5.10 added Change-Id: Iade26098325ba00e45cc055c9ebf8ff8fe2cd67b Reviewed-by: Liang Qi <liang.qi@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-262-2/+2
|/ / | | | | | | | | Change-Id: I0988a4119b5bd790d286c16b5647d97d4d95aef0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devv5.10.0-alpha1Liang Qi2017-08-151-0/+5151
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I3dd9c568ed9160510bff527355ecfbed5d4690a9
| * Update binary compatibility file for Qt 5.9.0 for QtWebSocketsMilla Pohjanheimo2017-06-301-0/+5151
| | | | | | | | | | | | | | Binary compatibility file updated for Qt 5.9.0. Change-Id: I58561a76c8f9d3353d9cf352dd39734044c3e8e2 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>