Age | Commit message (Collapse) | Author |
|
make_array() has been introduced to cover for shortcomings on macOS and
Windows. These shortcomings are no more there, so we can just use the
standardrlibrary.
|
|
|
|
|
|
The original (more complex and comprehensive) solution belongs to
https://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html - this
commit only provides a small wrapper for non-copyable Private class
implementations common throughout libQuotient. Unlike the original,
default initialisation is made explicit - you have to pass
ZeroImpl<Private>() instead (and I firmly believe it's a good thing:
normally pointers to Private should not remain nullptr). The reason
ZeroImpl<> is not a template variable is quite simple: unique_ptr is
non-copyable and so cannot be initialised from; while a template
function will initialise the value in-place thanks to copy elision.
|
|
- BaseJob::prepareError() slightly updated to get the current status
instead of checking the returned value outside in gotReply()
- BaseJob::gotReply() no more reports on 429 Too Many Requests twice
(the first time with dubious "Too Many Requests: Unknown error")
|
|
|
|
This is meant to spare clients from having to percent-encode
room aliases, v3 event ids etc. that happen to hit the endpoint path.
It is unfair to expect clients to do that since they are not supposed
to care about the shape of CS API, which parameter should be encoded
in which way. The trick (together with the slightly updated GTAD
configuration) is to percent-encode parts that happen to be QStrings
and not `const char[]`'s while passing all constant parts as plain
C character literals. This also allows to make it more certain that
the path is correctly encoded by passing and storing QByteArray's
wherever the path is already encoded, and only use QStrings (next to
const char arrays) before that.
Since the change alters the API contract (even if that contract was
crappy), some crude detection of percent-encoded stuff on input is
inserted; if input is already percent-encoded, a warning is put to
the logs, alerting developers about the change.
|
|
To provide more room for internal changes in BaseJob.
|
|
Turned out it was broken, and I was looking the other way.
|
|
The grand plan is to get rid of `BaseJob` and turn job invocations
to function calls returning `QFuture`. `RequestData` will stay though,
feeding data into those calls.
|
|
A previous incarnation, make_array, existed in basejob.cpp before.
The new direction taken by C++20 is to either deduce the array (but
the used Apple standard library doesn't have deduction guides yet) or
to use to_array() that converts a C array to std::array. This latter
option is taken here, with to_array() defined in quotient_common.h
until we move over to C++20.
|
|
It was a tiny wrapper around QUrlQuery to facilitate creation from
an initializer list - however, Mustache templates long changed to
not actually used that additional constructor.
|
|
The latter obsoleted the former since Qt 5.9, actually.
|
|
After going through all the files and the history of commits on them
it was clear that some copyright statements are obsolete (the code has
been overwritten since) and some are missing. This commit tries best to
remedy that, along with adding SPDX tags where they were still not used.
Also, a minimal SPDX convention is documented for further contributions.
Closes #426.
|
|
|
|
Port existing copyright statement to reuse using licensedigger
|
|
Fixes #437.
(cherry picked from commit 12e00b234e5c5f4ed57b5c400d06f780e71014f4)
|
|
(cherry picked from commit 4f06d46d6d6062d6d17f69eeaddb7810edac5bbf)
|
|
...to show the sunny-day case.
|
|
|
|
Usually QNetworkAccessManager expects the user to delete the replies, but when the QNetworkAccessManager itself is deleted it deletes all pending replies (https://code.woboq.org/qt5/qtbase/src/network/access/qnetworkaccessmanager.cpp.html#529).
This can lead to use-after-free crashes when d->reply is accessed. By putting the reply into a QPointer the exiting if(d->reply) checks can work properly.
|
|
|
|
(cherry picked from commit 1a832ae9b6a0d679b551fd644136e4bc17e7db29)
|
|
Proxy servers may return arbitrary HTML, for one example; so don't
expect to find a valid JSON object in whatever non-empty payload
next to a non-2xx HTTP code. Fixes #421.
(cherry picked from commit 9ef83e044ed4f8409156b19d529dfc7e45f565c1)
|
|
DeleteDeviceJob requires authentication, but the JSON data is not added for DELETE requests.
Since QNetworkAccessManager::deleteResource does not support body data, we need to send a custom request.
|
|
* QT_NO_URL_CAST_FROM_STRING makes it clearer where QUrls are created
from QStrings (which incurs a parsing cost).
* QT_STRICT_ITERATORS helps detecting where begin()/end() is used
instead of cbegin()/cend(). KDE developers have verified that
the generated assembly code is identical.
|
|
The most frequent occurence of IncorrectResponse so far is a proxy/CDN
failure. This is not a grave error; there's a chance that the retry will
succeed. In the worst case the job will fail after 3 identical errors
(except SyncJob that will try to get through forever - but SyncJob
failures should still be indicated in the client's UI in some
non-intrusive way).
|
|
|
|
Long run tests over 2+ days kept crashing before this commit but
stopped crashing with pipelining on and HTTP2 off.
|
|
|
|
TooManyRequests can come without a payload, apparently.
|
|
* JSON response is stored internally in BaseJob, rather than passed
around virtual response handlers. This allow to lazily deserialise
parts of the JSON response when the client calls for them instead of
deserialising upon arrival and storing POD pieces. This is
incompatible with the current generated code, so temporarily FTBFS.
* BaseJob::loadFromJson() and BaseJob::takeFromJson() have been added
to facilitate picking parts of the result as described above
in derived job classes.
* BaseJob::jsonData(), BaseJob::jsonItems() and (protected)
BaseJob::reply() for direct access to the response in its various
forms.
* To further eliminate boilerplate code in generated job classes,
a group of *ExpectedKeys() methods has been added - this allows to
reflect the API definition of required response keys in a more
"declarative" way, delegating validation to BaseJob.
* parseReply() and parseJson() pair turns to singular prepareResult().
Thanks to all the changes above, in most cases it will not need
overriding, unlike before.
* BaseJob::Private::parseJson() is introduced, to wrap
QJsonDocument::parseJson() into something less verbose. This serves
a completely different purpose to the former BaseJob::parseJson().
* BaseJob::doCheckReply() takes the place, and the name, of
checkReply().
|
|
parseJsonDocument() will come later.
|
|
Qt 5.15 renamed HTTP2AllowedAttribute to Http2AllowedAttribute,
deprecating the old spelling.
|
|
No functional changes either.
|
|
No functional changes here.
|
|
|
|
The code is really defensive now, making sure there's exactly one slash
between the base path and the endpoint. It's still very conservative
about the path composition otherwise (no normalisation etc.).
|
|
Due to a missing return statement, a retry with auth case led to the job
being finished and pending at the same time, with no good consequences.
|
|
Longer running on RHEL/CentOS 8 leads to crashes that no more occur
with disabled pipelining.
|
|
|
|
This is a Quotient part of #328 fix; QtOlm part is pending.
|
|
|
|
A part of the fix for #398.
|
|
|
|
* BaseJob::initiate() now calls ConnectionData::submit()
without relying on Connection to do that
* ConnectionData::submit() is now the only site where a job enters
Pending state
* No more shortcuts to BaseJob::sendRequest(), even retries are sent
through the ConnectionData submission queue
* Additional validation in BaseJob::initiate() that the request data
device is actually open (because QtNetwork API officially
requires that, even if you can get away passing a closed QBuffer
to it)
|
|
The first part closes #358; the second part is a workaround for non-standard
cases when endpoints without security by the spec turn out to be secured
(in particular, the case of authenticating media servers).
|
|
|
|
|
|
|