summaryrefslogtreecommitdiffstats
path: root/src/network/access/qrestreply.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Extract the content-type parser from qrestreply.cppMarc Mutz2025-10-011-244/+2
| | | | | | | | ... so it can be reused elsewhere. Pick-to: 6.10 6.8 Change-Id: Ia6b5f24cfbc586f0afe470cbb399cbb234c92f3d Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* CRA[network/access]: Mark some more critical filesMårten Nordheim2025-07-281-0/+1
| | | | | | | | | | The files parse data received from the network and/or otherwise make decisions based on the data received. Task-number: QTBUG-135582 Pick-to: 6.10 6.9 6.8 Change-Id: I35876cc1f4030b386d8400bc63597f35c23434ef Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Straighten out various logging categoriesUlf Hermann2024-06-191-1/+1
| | | | | | | | | | | | Either make them static or declare them in a header. We want them to be static wherever possible, in order to reduce the number of visible symbols. If they can't be static, however, they should at least be declared in only one place. Task-number: QTBUG-67692 Change-Id: I6f3b596ed4f0adc9873dd0a5f54f055a991a6207 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QRestReply TP markingJuha Vuolle2024-06-051-2/+0
| | | | | | | | | [ChangeLog][QtNetwork][QRestReply] This class is no longer "under development and subject to change". Pick-to: 6.8 Change-Id: I8c7ae54b33fd9a6edb22a35ca58ef87da68a9b0b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use QHttpHeaders: Update internal users of QNRequest, QNReply, QNProxyLena Biliaieva2024-05-071-2/+2
| | | | | | | | | | | | | Replace QNetworkHeadersPrivate's main headers storage, which was RawHeadersList, with QHttpHeaders. Replace internal usage of raw and cooked header methods with the QHttpHeaders API. [ChangeLog][QtNetwork][QNetworkRequest] Header value added by QNetworkRequest::setRawHeader() method is trimmed now. Task-number: QTBUG-107751 Change-Id: I8882978afa430651e6c798a4fed00beef6c4cfd2 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QRestReply: allow comments where white-space is allowedMarc Mutz2024-05-031-8/+56
| | | | | | | | | | | | | This is RFC2822 grammar (except that line folding is not allowed). RFC9110 doesn't allow it anymore, but it might make sense to accept it nonetheless (Postel's Law). Pick-to: 6.7 Task-number: QTBUG-123544 Change-Id: Ie990cd332c7603dbdae29c19b2804bd33a058ca0 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QRestReply: make charset parsing more robustMarc Mutz2024-04-261-19/+207
| | | | | | | | | | | | | | | | | | | | | | The old code was based on QString::split and e.g. didn't handle escapes in quoted-strings. Write a modern recursive-descent parser to parse out type/subtype and charset parameter. Since we don't, yet, support CFWS (see below), recursion depth is strictly limited, so we're not susceptible to recursion bombs here. It currently handles only RFC9110-style grammar, but can be easily extended to support CFWS (RFC2822-style comments and folding white-space) or RFC2231-style continuuations, if needed. It's a bit more general than strictly required, because I expect this to be reused elsewhere ere long. Pick-to: 6.7 Fixes: QTBUG-120307 Change-Id: I309928dc350a043672dffb4a259b457764c031be Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QRestReply: micro-optimize optional<QStringDecoder> handlingMarc Mutz2024-04-181-1/+1
| | | | | | | | | | | Use optional::emplace() instead of assignment from an rvalue. Saves the move constructor and destructor calls, both of which are not trivial (due to cleanFn). Pick-to: 6.7 Change-Id: Ief77626c77d0c8c2ce17e3b1a21496a7da969761 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Network: cleanlinessMårten Nordheim2024-04-051-1/+1
| | | | | | | | | QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_BYTEARRAY QT_NO_URL_CAST_FROM_STRING Change-Id: Ic77ed8ccbdb146b7e7b26123923795f9748d3a38 Reviewed-by: Mate Barany <mate.barany@qt.io>
* QRestReply: fix "No relevant classes found." moc warningMarc Mutz2024-03-141-2/+0
| | | | | | | | | | | QRestReply is no longer a QObject, so remove the includemocs line from the .cpp file. Amends 9ba5c7ff6aa42c5701cf950d2137467a2d178833. Pick-to: 6.7 Change-Id: I6c0ba6b9e3b82f84f3b509755e7da5b33e607776 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Remove unsused includes in QRestReplyJuha Vuolle2024-03-011-2/+0
| | | | | | | | | | The removed includes were needed when there were separate methods for returning QJsonArray and QJsonObject Pick-to: 6.7 Change-Id: I5f08c4afd5487c5ca191ee813a3d94c4ae3b0f06 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Documentation improvement in QHttpHeaders and REST classesJaishree Vyas2024-02-291-7/+6
| | | | | | | | | Language and some other improvisations Fixes: QTBUG-120028 Pick-to: 6.7 Change-Id: Id5a5544abf244de5cff83f0d795732595934bd36 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Rename QRestReply data accessors as read* functionsJuha Vuolle2024-01-301-9/+9
| | | | | | | | | | | | This naming should make it clearer that (successful) calls to readJson(), readBody(), and readText() consume the data received so far. Resulted from API-review Pick-to: 6.7 Change-Id: I09ca9eac598f8fc83eecb72c22431ac35b966bf5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Update QRestReply documentationJuha Vuolle2024-01-291-8/+38
| | | | | | | | | | | To accommodate the deduplication and non-owning changes in previous commit. Resulted from API-review Pick-to: 6.7 Change-Id: Ie1c4e9959c1ba7e8ed2be6607d9f6497ae15af39 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Make QRest* APIs non-owning and non-duplicatingJuha Vuolle2024-01-291-170/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: documentation will be updated in a follow-up commit This commit makes QRestReply and QRestAccessManager classes lighter, non-owning wrappers. Furthermore their APIs don't duplicate the wrapped QNetwork* APIs. This makes it easier to use / opt-in to these helpers in pre-existing applications which are based on QNetworkAccessManager and QNetworkReply. Since APIs are no longer duplicated, the QRest classes are more obviously a convenience _wrapper_, as opposed to being an alternative vertical stack. In practice this change consists of: - QRestAM never instantiates QNetworkAccessManager, but accepts it via constructor. It does not take ownership of the QNetworkAccessManager. - QRestReply accepts QNetworkReply via constructor. It does not take ownership of the QNetworkReply - Signals and most duplicated functions are removed from both QRestAM and QRR. - QRestReply is no longer a QObject - Since QRestAM doesn't have much to report anymore, the debug operator is dropped. Resulted from API-review Pick-to: 6.7 Change-Id: Ib62d9cc2df41cac631396a84bb7ec4d2d54b0c8c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QRestReply: optionally return the QJsonParseError from json()Marc Mutz2024-01-121-7/+10
| | | | | | | | | | | | | | ... and remove the debug output of the internal QJsonParseError. This allows users of the function to get the details in machine-readable form, and to distinguish between !finished and an actual Json parsing error. Found in API-review. Pick-to: 6.7 Change-Id: Ia237b192a894d692b965f6bedb4c94d3b6537535 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Change QRestReply json return type to QJsonDocumentJuha Vuolle2024-01-121-44/+10
| | | | | | | | | | | The json return type and function naming has gone back and forth. Let's go with QJsonDocument after all, and add new overloads in future if necessary. Pick-to: 6.7 Task-number: QTBUG-119002 Change-Id: I3f9de0e6cba7d5c52d016d252d65b81f345af050 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add streaming text support to QRestReplyJuha Vuolle2024-01-101-18/+21
| | | | | | | | | | | Provides the possibility to read text data as it arrives, instead of needing to wait until the whole body is received. Pick-to: 6.7 Task-number: QTBUG-119002 Change-Id: I64f90148fd41a77c4ae2d5dbd6194a924a9f3a86 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Mark REST helper classes as tech previewJuha Vuolle2023-12-081-0/+2
| | | | | | | Task-number: QTBUG-119002 Change-Id: Icf4d50b0e6f25e4e5f82df0b23a249332bbf55bf Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QDebug support for QRestReplyJuha Vuolle2023-12-081-0/+54
| | | | | | | | Task-number: QTBUG-114705 Change-Id: I6c355d683389b773082c5966434d733bf5aec506 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add uploadProgress signal for QRestReplyJuha Vuolle2023-12-081-1/+22
| | | | | | | Task-number: QTBUG-114717 Change-Id: I2052e4cc4da90962483f5f1931dc20552e484e34 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add signals and methods for QRestReply download progressJuha Vuolle2023-12-081-1/+47
| | | | | | | | | | | | These include: - readyRead(), signal for indicating new data availability - bytesAvailable(), function for checking available data amount - downloadProgress(), signal for monitoring download progress Task-number: QTBUG-114717 Change-Id: Id6c49530d7857f5c76bd111eba84525137294ea7 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add REST client convenience wrappersJuha Vuolle2023-12-081-0/+364
[ChangeLog][QtNetwork][QRestAccessManager] Added new convenience classes QRestAccessManager and QRestReply for typical RESTful client application usage Task-number: QTBUG-114637 Task-number: QTBUG-114701 Change-Id: I65057e56bf27f365b54bfd528565efd5f09386aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>