This test is using QtConcurrent::run(). This call does not seem
to require linking with the library. But this is not documented,
so let's link anyway.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I623133c478fdeda173cb9b7bcf6cd167f46526af
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Adjust one test case to use such a lambda.
Fixes: QTBUG-104481
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I96e30fd167b8c2f8240316bff9c283efdb910541
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This allows one to combine those methods.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: Ibc6007b3df721893638f45d59ce1ac1c12078343
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Replace "universal reference" with "rvalue reference". Universal references
appear only with type template parameters or `auto`.
This amends 8bba89d043.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I5087c84a37dc90f87f7613a5c467ce5011dfa51e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We want to know whether the type is usable with QVariant - for that we
are only interested in whether we can copy it. So check that directly.
For addConverter, there should not be a need for any precondition.
Pick-to: 6.4
Change-Id: I66dc7f4a55a25514aa4439c40260b4e80e9cfed8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The converter regexps may be provided by user and come from memory
that may be freed/modified by the user later. Store QString's instead.
Adjust the setter APIs to use QAnyStringView when possible.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I6f643ecdc4af39988308fe58744bc60473649851
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This allows to deny a websocket upgrade with e.g.
a HTTP error ServiceUnavailable instead of hard
disconnection if the application has some special
logic.
Also fire missingHandler for WebSockets for
better application integration.
Pick-to: 6.4
Change-Id: I31f4b66f9a9a7873a46d0eaba6b6121b1a9ac953
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I4463e3d03c18748e9a03320261b7f6efcdbd43f8
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Normally the lifetime of a QTcpSocket is handled by the connections
established in the QAbstractHttpServerPrivate::handleNewConnections()
call.
However, when a QTcpSocket needs to be upgraded to web socket, its
lifetime will be managed by an instance of QWebSocketServer. When an
instance of QWebSocket is created, it wraps the underlying QTcpSocket.
On destruction, such QWebSocket calls QTcpSocket::disconnect(), which
removes all the connections that were previously established in
QAbstractHttpServerPrivate::handleNewConnections(). As a result, the
QHttpServerRequest object is leaked.
In practice, when the TCP socket is upgraded to websocket, we no longer
need to handle its lifetime in the QAbstractHttpServerPrivate, and we
also no longer need the QHttpServerRequest instance. So this patch
explicitly removes all the outdated connections and deletes the request
before upgrading the socket to websocket.
Fixes: QTBUG-104538
Pick-to: 6.4
Change-Id: I518fe50d7eba4207d50eb0eda5b570784f2a4627
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
QSslConfiguration is transitively included from qwebsocketserver.h,
but if we have SSL support and no websockets, the compilation breaks.
Pick-to: 6.4
Change-Id: If72107c32fdfb793163f0f699104b9592ee7d753
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
These data is not shared.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I57a68eeae2be7ec2afe6048ca336e6e92e2b941e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It works just fine without the if statement.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: Ia314d142525902080de12bca03e634c3c7d9e1cc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The generic version works the same way as the zero arguments
specialization except for out-of-bound argument access.
Out-of-bound argument access was only used by tst_qhttpserverrouter
and is removed by this commit.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I49b8d7623ed758b34f9726a497f86333d6002242
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Use constexpr if instead of enable_if for some readability.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: Ieef51baa78d1cbff8240f7ea8d2ed74b76bd321f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Forward-declare the used classes instead in the header and include them
in the corresponding source file.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I10a288818df6cad0b089351816f0a2d0eb9c012d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This will make sure find_package explicitly fails if
HttpServer component is missing.
Change-Id: Ibda6059b77411cf482a747a16c97c178ea4f8563
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@gmail.com>
This makes sure the classes also show up in newclasses64.html
Pick-to: 6.4
Change-Id: I99b0940bafe01e3c3a6d9c28191053e3dd078ae6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
We shouldn't advertise the include module header anymore. Instead, each
class advertises its header.
Pick-to: 6.4
Change-Id: If7a90c41a9986980f81053f86da29090e5de466e
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
... delaying its initialization until first use.
Before, it would happen during program startup, slowing down startup
of all application using this library.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I56dd3c5b96ad3ffd8a8adcd4f276ab9133593f9c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This generates meta information and default helper for the
StatusCode like debug streams.
Pick-to: 6.4
Change-Id: I1d8c55b9aea65560af7ea7796b5a0c3b83b84276
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
We can't add a op<<(QDebug, std::initializer_list) because this module
doesn't own either of them, so when QtBase adds one to qdebug.h, we'd
run into ODR violations.
Instead, define it for a wrapper instead.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I23fe1f6b852b7a01dd7ae044da22df19cdb7f681
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
There's no reason to use a doubly-linked list here, so don't.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I6e82ab9b537800dc434a3d92fe31cca43bc513c4
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QtHttpServer depends on a lot of other libraries, any one of which may
still store a QByteArray shared with these "literals" when this leaf
library gets unloaded on program shutdown. Any attempt to index into
such QByteArrays at program shutdown would then reference unloaded
data.
It's a rather theoretical bug, but there's a reason why Qt no longer
unloads any plug-ins, and this is the same scenario, so fix by
allocating the data on the heap. Even if the file-statics are
destroyed at library unload time, the data, if referenced elsewhere,
will survive.
Pick-to: 6.4
Task-number: QTBUG-45582
Change-Id: I2b6bb4f32e86c64038efd7783b5b193bc5bc362d
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
GCC complains that `state` may contain an unenumerated value and
therefore `read` may be used uninitialized:
qhttpserverrequest.cpp: In member function ‘bool QHttpServerRequestPrivate::parse(QAbstractSocket*)’:
qhttpserverrequest.cpp:297:21: error: ‘read’ may be used uninitialized [-Werror=maybe-uninitialized]
297 | return read != -1;
| ^
qhttpserverrequest.cpp:266:15: note: ‘read’ was declared here
266 | qsizetype read;
| ^~~~
Fix by inserting a strategic Q_UNREACHABLE(). Do so without a default:
case which would break -Wswitch warning about unhandled enum values.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: If9514c676f3e927fd748781147f2c02e5ca35d4c
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Use constexpr-if instead of overloads with enable_if. Keeps things DRY
and easier to follow.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I2e8acd6b9164e92fcabe1f91ce7529f8d4b00b98
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Generates less code, and we may be able to remove QDebug includes.
Some uses aren't easily ported, leave them as ostream-style.
Also prefer %ls/qUtf16Printable() over %s/qPrintable() (again: less
code).
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I812bed2ecfeb5776155ff5f95320d6accc5974d3
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
... instead of an exported class with only static members.
Also minimize header includes.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: Iab63dc30600b536030f84f435701ae2ff845d7e0
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
There was no implementation to back it.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: Ieb2b2ff65d96a6aa7d63ea34956f584446f5e262
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
First, the implementation is 1:1 identical with
QHttpHeaderParser::combinedHeaderFields(), so simply call
that. Second, the defaulted defaultValue argument isn't used, so
remove.
Since the implementation is now a trivial forwarder, inline it.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I7fe0c7f28a4686a464b0faa10cd41e45995cb5f1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
It's just as thin wrapper around the QHttpHeaderParser function of the
same name, so remove the function and inline it into the only user.
Pick-to: 6.4
Task-number: QTBUG-100868
Change-Id: I0120ec9b6b1476a03eded250baad64b5ddd5df9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
To avoid an implicit conversion from QObject *.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: I9081264228e52f8abac6a4469d933be3dcb5d318
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Also include qstringfwd.h for QByteArray.
Task-number: QTBUG-100868
Pick-to: 6.4
Change-Id: Ibae6314f584af418bddad6e5976e5c15e990189e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>