Commit Graph

11 Commits

Author SHA1 Message Date
Olli Vuolteenaho cc96264b62 Shorten local socket path in autotest
The limitation on Unix domain socket paths on Linux is 107 characters.
After c617cc95934ae3c0896082d61a88487b34cf96be the temp directory
handling on Android must have changed to go past that limitation. When
testing this the socket path on my device was

/data/user/0/org.qtproject.example.tst_qhttpservermultithreaded/cache/
tst_qhttpservermultithreaded_local11757

...which is too long and therefore the listening on the socket will
fail.

The simple quick solution to get everything working is to just shorten
the socket name a bit. Combined with the application PID it should still
be unique and not cause any other issues.

Pick-to: 6.10 6.9
Fixes: QTBUG-137849
Change-Id: Ib606ea315d7a929a37a0639c07ed08b474b54812
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2025-06-24 18:20:41 +03:00
Mårten Nordheim f97852e34c tst_qhttpservermultithreaded/Linux: Use abstract namespaces for localsocket
We don't really need the file descriptor for the local socket, so we can
avoid it entirely by using an abstract namespace. With this we don't
leave files behind even if the test crashes.

Change-Id: I99cdd8d4c70b6651404542d53100c6127078f8a5
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
2025-06-11 12:28:10 +02:00
Mårten Nordheim 998a40d39c tst_qhttpservermultithreaded: Make the localsocket server name unique
So that instances of the test can be ran in parallel without colliding.

Pick-to: 6.9
Change-Id: I9f4497eed9841650c5f52382ae5c20e4bd73355a
Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
2025-05-28 13:21:49 +02:00
Øystein Heskestad 7190817ff6 Fix test to not take lvalue into the lambda of a concurrent run
Though a route() callback can take references as arguments, they
might go out of scope when they are passed by reference to concurrent
runs. Copy the necessary data into objects that can be passed by value
into the lambda used by a concurrent run.

Pick-to: 6.8 6.9
Change-Id: I823ba380c30078624a33c73e95c60f91866bc1f4
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2025-03-04 09:20:37 +00:00
Timur Pocheptsov bba15a7cf5 QHttpServer auto-tests: use a function provided by QTest
Instead of having code-duplicates.

Pick-to: 6.9 6.8
Task-number: QTBUG-132645
Change-Id: I6976ae44a0ab14857d71d1cd6eef3cc09e40db34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-02-18 16:51:37 +01:00
Timur Pocheptsov 89546a6a1e httpserver (multithreaded) do not block the test on keychain access
Similar to httpserver.

Task-number: QTBUG-130500
Pick-to: 6.9 6.8
Change-Id: Ia93c03db5ee4f7c549a37c60db639bc7f47b8c9b
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-01-07 11:13:33 +01:00
Volker Hilsheimer a4b22aa7da Fix warning from unused variable
The sslPort variable is only used when SSL is available, which is
usually not the case on macOS builds.

Pick-to: 6.8
Change-Id: I6f8c023c2a85e5a3c74d737903cb994c690451a3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-09-26 16:15:07 +02:00
Øystein Heskestad bd5ac90224 QAbstractHttpServer: Remove QSslConfiguration and listen() methods
To keep the API lean, remove the SSL confguration and listen()
methods.

Instead using listen() on a QAbstractHttpServer, a user should
create an instance of a QTcpServer or QSslServer, then call
listen() on it before calling bind() on a QAbstractHttpServer
with it as an argument.

Task-number: QTBUG-125859
Pick-to: 6.8
Change-Id: I366c0a01d8b7ee3802e0bdd63b9d84813338f478
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-07-31 16:52:41 +02:00
Øystein Heskestad d3c3d723bb QAbstractHttpServer: Replace header include with forward declaration
Task-number: QTBUG-125859
Pick-to: 6.8
Change-Id: I8603d3b25621ecdbfee4be48431ca2f8d30c9ea3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-06-26 09:34:06 +02:00
Volker Hilsheimer 6ecfc86efc Fix build of tests on Android without SSL enabled
Pick-to: 6.8
Change-Id: I996f020a66b18ad48ea2480f02741c0331e70186
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-06-19 12:46:31 +02:00
Øystein Heskestad 362d409118 QHttpServer: Add tests for routes returning QFuture<QHttpServerResponse>
And update documentation.

Task-number: QTBUG-75081
Change-Id: Ia4b168a1a46842e3754ebee9e9e205cd29a9e0f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-29 15:47:41 +02:00