summaryrefslogtreecommitdiffstats
path: root/src/network/access
Commit message (Collapse)AuthorAgeFilesLines
...
* Network: Use QHttpHeaders in QHttpHeaderParserLena Biliaieva2024-01-2516-80/+67
| | | | | | | | | | | | | QHttpHeaderParser::headers() method is changed to return QHttpHeaders. QAuthenticatorPrivate::parseHttpResponse() method is changed to work with QHttpHeaders. QHttpNetworkHeader::header() method is updated to return QHttpHeaders. Tests are updated. Task-number: QTBUG-120133 Change-Id: I20a18b509acd7a8b8d93884cff8349519d64293e Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Make the QtNetwork private symbols visibleAlexey Edelev2024-01-222-2/+2
| | | | | | | | | Export QHttpNetworkConnection and QHttpNetworkReply classes, this is required to use the freshly introduced QHttp2Stream. Pick-to: 6.7 Change-Id: I4920d342af943b393afa78a187b562549fa919e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove QHttpHeaders::names()Juha Vuolle2024-01-203-18/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. Until now, the only way was for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So we added nameAt() and valueAt() functions in previous commits to enable efficient indexed iteration without the need to expose a value_type. Having added those, we can now remove names(), which had the wrong value_type (QByteArrays are by definition UTF-8 in Qt, while header names are L1), and is no longer needed to facilitate iteration. In QNetworkRequestFactory, temporarily use toMultiMap() because we need the combinedValue() of all headers here. The fix will be to make QNetworkRequest QHttpHeaders-aware, but that's a Qt 6.8 thing, even though we should still de-pessimize this code for Qt 6.7 with private API. Resulted from API-review. Pick-to: 6.7 Change-Id: I65086ef4c62e22554ae7325a846bebc08b44916f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add QHttpHeaders::nameAt() functionJuha Vuolle2024-01-202-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. For now, the only way is for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So add nameAt() and (in a previous commit) valueAt() functions to enable efficient indexed iteration without the need to expose a value_type. Return by QLatin1StringView, not QAnyStringView, because that statically encodes the actual encoding used (and required by HTTP specs and promised by the class documentation, so it won't need to change). For the setters, we want to be accomodating QString, QByteArray, etc, which is why those take QAnyStringView. Resulted from API-review. Pick-to: 6.7 Change-Id: I0153c5aad0f6260b5dbc963de0aaf4ef42fdd4f1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QHttpHeaders::valueAt() functionJuha Vuolle2024-01-202-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. For now, the only way is for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So add valueAt() and (in a follow-up) nameAt() functions to enable efficient indexed iteration without the need to expose a value_type. Resulted from API-review Pick-to: 6.7 Change-Id: I863f59618cea5682386ce26b66b4b1655eac7950 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QH2Connection: Fix issue with unity-build/odrMårten Nordheim2024-01-184-87/+48
| | | | | | | | | | The static function appeared in two places, and in a unity-build this fails quite visibly. Pick-to: 6.7 Change-Id: I60000d01194a2c79ca9c101f2a6d3f77f469f1a7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Nodir Temirkhodjaev <nodir.temir@gmail.com>
* QH2Expected: use Rule Of ZeroMarc Mutz2024-01-181-5/+1
| | | | | | | | | | | | | | It doesn't always pay to be explicit about SMFs. In the present case, clang-tidy complains that the move ctors of the class aren't noexcept. It's a false positive, but just removing all the =default'ed SMFs makes it go away, too. Amends 0dba3f6b713a657eb3bf2037face72d16253eb92. Pick-to: 6.7 Change-Id: Ib641d4eed9e214b41c143b60494e82790da6fda8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Http: Start more connections faster after determining network layerMårten Nordheim2024-01-181-1/+3
| | | | | | | | | | | | | | | | | Previously we would more or less wait for the first connection to finish before initiating more connections. This was just happening by virtue of calling startNextRequest when a request was finished. Since we have already determined the preferred network layer, let's just try to start more connections. In case we are using https this doesn't make a difference because we will try http2 upgrade first before allowing multiple connections. Unless, of course, http2 has been disabled. Fixes: QTBUG-120619 Pick-to: 6.7 6.6 6.5 Change-Id: Id3c3be59fd07120bff574d63481119e5ed9eb88a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkRequest: export the static constexpr (inline) member variablesThiago Macieira2024-01-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All that is required is that we write the declaration as if they weren't inline, like we used to for C++98 non-constexpr static members. Amends 090991123dd82796fe956e4153bc26ace22280ca. This is required with MinGW and happens with both GCC and Clang: when a static constexpr variable found in an exported class is used in a context that requires getting its address, the compiler emit a DLL- importing statement. For example: void f(const std::chrono::milliseconds &ms); void f() { f(QNetworkRequest::DefaultTransferTimeout); } Emits with GCC: _Z1fv: movq __imp__ZN15QNetworkRequest22DefaultTransferTimeoutE(%rip), %rcx jmp _Z1fRKNSt6chrono8durationIxSt5ratioILx1ELx1000EEEE And Clang: _Z1fv: # @_Z1fv # %bb.0: movq __imp__ZN15QNetworkRequest22DefaultTransferTimeoutE(%rip), %rcx jmp _Z1fRKNSt6chrono8durationIxSt5ratioILx1ELx1000EEEE # TAILCALL Pick-to: 6.7 Fixes: QTBUG-121135 Change-Id: I76ffba14ece04f24b43efffd17aae1a98071c570 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: André Klitzing <aklitzing@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Privately introduce QHttp2ConnectionMårten Nordheim2024-01-174-13/+1789
| | | | | | | | | | | | | | | For use in QtGRPC. There is some duplication between this code and the code in QHttp2ProtocolHandler. But let's not change the implementation of the protocol handler after the 6.7 beta release. Nor do I think we should do it for 6.8 LTS. So let's just live with the duplication until that has branched. Pick-to: 6.7 Fixes: QTBUG-105491 Change-Id: I69aa38a3c341347e702f9c07c27287aee38a16f2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Add static access function to wellknown headersJuha Vuolle2024-01-172-0/+10
| | | | | | | | | Resulted from API-review Pick-to: 6.7 Change-Id: I438a5cf9c88b572adece99af0314eefbc4371f8f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove HTTP headers equals() / comparisonJuha Vuolle2024-01-155-107/+0
| | | | | | | | | | | | | | | | | | | | | | There's several ways to compare HTTP headers, and arguably the need for it is not very high. For the time being users can use different accessors and compare in ways that make sense for their use cases. Consequently since HTTP headers are no longer trivially comparable, it makes also comparing the request factories more 'moot' because headers are a central piece of request information. So removed comparison from request factory as well. These comparisons can be restored later if a clear understanding on it's need, and on how it should be best done, emerges. Resulted from API-review Pick-to: 6.7 Change-Id: Idb5ab3710268b52a8e59656db8cc7de82f0ae511 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Rename QNetworkRequestFactory header functions to commonHeadersJuha Vuolle2024-01-152-9/+9
| | | | | | | | | | Resulted from API-review Pick-to: 6.7 Change-Id: Iae712e67839d27064a0155830fd201ab15693091 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Rename the replace() function's value to newValue to reflect its roleJuha Vuolle2024-01-122-9/+9
| | | | | | | | | Found in API-review Pick-to: 6.7 Change-Id: Ib047c79d977ad6870c1e426cd1add994a3634df4 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Rename qnetworkrequestfactory's request() to createRequest()Juha Vuolle2024-01-122-8/+8
| | | | | | | | | Resulted from API-review Pick-to: 6.7 Change-Id: I09349dbddbfc191d871563b834396b387c6153c9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QRestReply: optionally return the QJsonParseError from json()Marc Mutz2024-01-122-8/+12
| | | | | | | | | | | | | | ... 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>
* QRestReply: include / fwd-declare what you needMarc Mutz2024-01-121-0/+6
| | | | | | | | | | Don't depend on transitive includes and forward declarations. Found in API-review. Pick-to: 6.7 Change-Id: I61b9517453f164391abb9254d92e7ea38051e730 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Change QRestReply json return type to QJsonDocumentJuha Vuolle2024-01-123-47/+11
| | | | | | | | | | | 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>
* Rename QHttpHeaders::has() to contains()Juha Vuolle2024-01-112-6/+6
| | | | | | | | Resulted from API-review Pick-to: 6.7 Change-Id: I84e880dc6edb9c62fd1ddd50d477347443fd52a7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add QHttpHeaders::reserve()Juha Vuolle2024-01-112-0/+13
| | | | | | | | Found in API-review Pick-to: 6.7 Change-Id: Ia41eb91e9e62a252b76c20c67c1c599c0f6a633d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Simplify QHttpHeaders documentationKai Köhne2024-01-101-3/+2
| | | | | | | | | Simplify wording, leave out historical baggage (which is not really relevant for users that look into new code). Pick-to: 6.7 Change-Id: I9be1d42b6d75dd4bf6fccd6ecb47bc7cd6026ed3 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Remove an unused, leftover, includeJuha Vuolle2024-01-101-2/+0
| | | | | | | Pick-to: 6.7 Task-number: QTBUG-119002 Change-Id: Ic4054e82c11eede7823389d534bbe56328ce3dc8 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add streaming text support to QRestReplyJuha Vuolle2024-01-102-18/+26
| | | | | | | | | | | 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>
* QHttpHeaders: add value(name, fall-back)Marc Mutz2024-01-092-0/+26
| | | | | | | | | | | | | | | | | | | | | | | The vast majority of header fields appear only once, but there was no efficient way to get that value: values() returns as a QList<QByteArray> (allocating) while combinedValue() returns a QByteArray constructed from values().join() (also allocating). It follows that the QHttpHeaders API is incomplete (lacks an efficient basis of operations in EoP terms). Add a value() function that returns either the value or a user-provided fall-back as a QByteArrayView. Unlike values() and combinedValue(), this function can be noexcept, greatly improving codegen for callers. Found in API review. Pick-to: 6.7 Task-number: QTBUG-107042 Change-Id: I2da20815fd46fdd7f150c224f41eee53abed313e Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Http2: move assemble_hpack_block declaration to headerMårten Nordheim2024-01-083-27/+31
| | | | | | Pick-to: 6.7 Change-Id: I5033d433d2aa499007a6e436dbb70d9c48315e8b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Remove the use of Q_NETWORK_PRIVATE_EXPORTAlexey Edelev2023-12-221-1/+1
| | | | | | | Task-number: QTBUG-117983 Change-Id: I2339dc96b49aba38169ad3e84f48c9d3c97d6117 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Http2: fix potential overflow in assemble_hpack_block()Marc Mutz2023-12-201-2/+6
| | | | | | | | | | | | | | | | | | | The function is given a vector of Http2::Frame's and flattens it into a vector<uchar>. While each Frame can contain a maximum of 16GiB of data (24-bit size field), one "only" needs 257 of them to overflow the quint32 variable's range. So make sure any overflow does not go undetected. Keep the limited uint32_t range for now, as we don't know whether all consumers of the result can deal with more than 4GiB of data. Since all these frames must be in memory, this cannot overflow in practice on 32-bit machines. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: Iafaa7d1c870cba9100e75065db11d95934f86213 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* HPack: fix incorrect integer overflow checkMarc Mutz2023-12-131-1/+3
| | | | | | | | | | | | | | | | | | | | This code never worked: For the comparison with max() - 32 to trigger, on 32-bit platforms (or Qt 5) signed interger overflow would have had to happen in the addition of the two sizes. The compiler can therefore remove the overflow check as dead code. On Qt 6 and 64-bit platforms, the signed integer addition would be very unlikely to overflow, but the following truncation to uint32 would yield the correct result only in a narrow 32-value window just below UINT_MAX, if even that. Fix by using the proper tool, qAddOverflow. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I7599f2e75ff7f488077b0c60b81022591005661c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* HPack: fix a Yoda ConditionMarc Mutz2023-12-131-1/+1
| | | | | | | | | | | | | | | | Putting the variable on the LHS of a relational operation makes the expression easier to read. In this case, we find that the whole expression is nonsensical as an overflow protection, because if name.size() + value.size() overflows, the result will exactly _not_ be > max() - 32, because UB will have happened. To be fixed in a follow-up commit. As a drive-by, add parentheses around the RHS. Pick-to: 6.7 6.6 6.5 6.2 5.15 Change-Id: I35ce598884c37c51b74756b3bd2734b9aad63c09 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: QRestAccessManager: Qualify template arguments in \fn commandsTopi Reinio2023-12-131-26/+26
| | | | | | | | | | | | Since version 6.7, QDoc requires accurate definition of template arguments in signatures passed to the \fn command. Qualify the 'if_compatible_callback' template with the class it's declared in. Pick-to: 6.7 Change-Id: Ifd4618071c950e812c4df9a2e4e212317a6c9118 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Make QNetworkRequest::KnownHeaders a Q_ENUMMarc Mutz2023-12-092-0/+5
| | | | | | | | | | | | ... so QDebug e.g. stringyifies it automatically. Requires making QNetworkRequest a Q_GADGET. Task-number: QTBUG-114647 Change-Id: Idb4f3ecd98f79c1e28596c7be763898aba4b6562 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QHttpHeaders: reserve memory for headers when creating from a containerJuha Vuolle2023-12-081-0/+3
| | | | | | | | | | | To avoid any potential resizes during append looping Task-number: QTBUG-119002 Change-Id: I8f4c391f05b5c5bd0b48a4f17b11996652006508 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Mark REST helper classes as tech previewJuha Vuolle2023-12-083-0/+6
| | | | | | | 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 PATCH support for QRestAccessManagerJuha Vuolle2023-12-082-0/+130
| | | | | | | | | | | It is somewhat common HTTP method with RESTful use cases (partial updates on resources) Task-number: QTBUG-114637 Change-Id: Id252d3f4b54c3ebb8df5c93259e64a4af2d0ca2f 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>
* QRestAM custom HTTP 'method' supportJuha Vuolle2023-12-082-1/+100
| | | | | | | | | | This commit adds support for sending custom, non-standard, HTTP methods / verbs. Fixes: QTBUG-116262 Change-Id: I77addb389a7e4346b63526176bf8323696a7a337 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add username/password support to QNetworkRequestFactoryJuha Vuolle2023-12-083-0/+98
| | | | | | | Task-number: QTBUG-114717 Change-Id: I8d6beb6f81668dcba59cbaee6044606fb874bad2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QDebug support for QRestAccessManagerJuha Vuolle2023-12-082-0/+26
| | | | | | | Task-number: QTBUG-114705 Change-Id: Id33dbfd6906989dfcde654a4f7d6ab4b5e743c33 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QDebug support for QRestReplyJuha Vuolle2023-12-082-0/+58
| | | | | | | | 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 QDebug support for QNetworkRequestFactoryJuha Vuolle2023-12-082-0/+35
| | | | | | | Task-number: QTBUG-114705 Change-Id: If3e9d67ee310192debf58771e365f6035d4b2da6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Functions for setting request transfer timeoutsJuha Vuolle2023-12-085-0/+63
| | | | | | | | | | Added to both QNetworkRequestFactory and QRestAccessManager Task-number: QTBUG-114717 Change-Id: Ibca55bba548a034a0da7ea60550642c150b63dc2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Support for std::chrono as transferTimeout typeJuha Vuolle2023-12-086-26/+99
| | | | | | | | | | | | | | | | | | | | Provide users with means to use more modern time/duration type. Please note that since QTimer does not currently support timeouts larger than 'int' milliseconds, the limit on how long durations can be expressed, remains. This should not be an issue in practice with network requests, as a typical int32 system can express timeouts of ~24 days. [ChangeLog][QtNetwork][QNetworkAccessManager] Add std::chrono support for transfer timeout. [ChangeLog][QtNetwork][QNetworkRequest] Add std::chrono support for transfer timeout. Fixes: QTBUG-118714 Change-Id: If85678a5994c59bac5926e47f98c9cfeb2a07c30 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add uploadProgress signal for QRestReplyJuha Vuolle2023-12-082-1/+23
| | | | | | | 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-082-1/+50
| | | | | | | | | | | | 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-086-0/+1474
| | | | | | | | | | | | | [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>
* QNetworkRequestFactory convenience classJuha Vuolle2023-12-083-0/+622
| | | | | | | | | | | | | | | | | | | | | The class provides a way to represent server-side service endpoints. With RESTful applications these endpoints typically have a need for repeating requests fields such as headers, query parameters, bearer token, base URL, SSL configuration. This class allows setting of the repeating parts, while allowing the setting of changing parts on a per-request basis. [ChangeLog][QtNetwork][QNetworkRequestFactory] Added a new convenience class to help with the needs of repeating network request details imposed by the server-side service endpoints, which is common with RESTful applications. Task-number: QTBUG-113814 Change-Id: Iabcfaed786949ffbb0ad0c75297d0db6ecc1a3cc Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add QHttpHeaders classJuha Vuolle2023-12-082-0/+1380
| | | | | | | | | | | | New QHttpHeaders class for use in place of std::pair<QBA,QBA>, QMap<QBA>, and QMultiMap/Hash<QBA,QBA> to represent HTTP headers. [ChangeLog][QtNetwork][QHttpHeaders] New QHttpHeaders class Task-number: QTBUG-107042 Change-Id: I54766886a491acfc9a813a3414322a75011acb9d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* wasm: Proxy emscripten_fetch() to the main threadPiotr Wierciński2023-11-221-1/+5
| | | | | | | | | | | | | | Calling emscripten_fetch() on worker thread which never yields control back to the browser, will leave the fetch request pending forever. This can be a problematic for example in QML Loader, which tries to load resource by network. Proxy this function call to the main thread, so it can be processed by the browser. Fixes: QTBUG-118225 Pick-to: 6.6 6.5 Change-Id: I969d73f6a66670c4135960e08d2eedc8d2a6e5c3 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* http2: Fix authentication code and raceMårten Nordheim2023-11-152-57/+78
| | | | | | | | | | | | By attempting to get credentials and potentially emitting error during header parsing we may not have gotten the DATA frames yet which would leave us emitting error() and finished() without any body. Pick-to: 6.6 6.5 6.2 Change-Id: Ibc5fb78193af80ddabaca2c9e4149bbcac9789a1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNonContiguousByteDeviceThreadForwardImpl: reset m_atEnd during reset()Mårten Nordheim2023-11-061-0/+1
| | | | | | | | | | | Because otherwise the atEnd() function will return true if we finished an upload, and then we reset due to an error and try to upload again. In a future patch we rely on atEnd() returning true only if the data has actually been consumed, so re-uploads will not work correctly. Pick-to: 6.6 6.5 Change-Id: Id914648f2509dd112b6bfc71231caa59cbe8ae68 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Http: simplify check for preconnect requestMårten Nordheim2023-11-062-4/+2
| | | | | Change-Id: I132533b9bc1f2b4d66f94599efb04def571cd2ff Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>