summaryrefslogtreecommitdiffstats
path: root/src/network/access
Commit message (Collapse)AuthorAgeFilesLines
...
* Document QHttpHeaders::WellKnownHeaders as the recommended overloadsJuha Vuolle2024-03-051-0/+7
| | | | | | | | | ... from a performance point of view. Pick-to: 6.7 Task-number: QTBUG-122020 Change-Id: I8a1558a46e74d740e330ad483454267f9922a5d5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make HTTP header name a variant / union for performanceJuha Vuolle2024-03-051-47/+188
| | | | | | | | | | | | | | | | | | | | | | | This saves memory and can speed up performance with well-known headers. The change consists of: - Change the internal type of 'name' to a std::variant capable of holding either WellKnownHeader-enum, or a QBA. - Accordingly, add an equality operator. - When headers are added (append, insert, replace) then use WellKnownHeader as storage type when possible; either use the function parameter directly if a WellKnownHeader overload was used, or check if the provided string can be converted to a WellKnownHeader. - Convert other functions to use a more performant lookup/comparisons. Pick-to: 6.7 Fixes: QTBUG-122020 Change-Id: If2452f6edc497547246fb4ddbace384e39c26c5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move few QHttpHeaders helper functions on topJuha Vuolle2024-03-051-20/+20
| | | | | | | | | | | As a prequel to make subsequent diff on the followup commit (std::variant/union) smaller Pick-to: 6.7 Task-number: QTBUG-122020 Change-Id: Iaa5dd794dc7a9e33c2c43e459bf5dbd19afb3ba1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add sorted lookup table for QHttpHeaders name fieldsJuha Vuolle2024-03-051-0/+222
| | | | | | | | | | | | | | | | This allows a more performant (O(logN)) lookup for WellKnownHeader enum (followup commit). The lookup table is currently crafted manually. It may in future be generated at compile-time, but this should only be done if new headers are appended often; we don't want to unnecessarily bloat compilation time either. Pick-to: 6.7 Task-number: QTBUG-122020 Change-Id: I0329902b13128f03c358796d5cda7014b1e75057 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Implement ping reply in QHttp2Connection and add testMatthias Rauter2024-03-042-6/+56
| | | | | | | Fixes: QTBUG-122338 Change-Id: I1e8dfa8a93c45dbe12a628d4d5e79d494d8f6032 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port to QDirListingAhmad Samir2024-03-031-5/+5
| | | | | | | | | | | Use QDirListing in the Bootstrap build instead of QDirIterator. Drive-by changes: - more const variables - use emplace_back() instead of append() where appropriate Change-Id: Ie1f0d03856e557c4bfabfff38a87edc7da86d091 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Handle informational HTTP replies (1xx) for HTTP/2Mate Barany2024-03-011-0/+7
| | | | | | | | | | | | | | | | Make QHttp2ProtocolHandler discard all informational (1xx) replies with the exception of 101. According to RFC 9110: "A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses." Fixes: QTBUG-121755 Change-Id: I8b8d578f23d4fbe28929f8c54b3607bcaf85405f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Mark QNetworkRequestFactory as TPJuha Vuolle2024-03-011-1/+1
| | | | | | | | | | | The documentation already marks the class as preliminary, but mark also with the new macro for that purpose. Amends: b4c90582a2dee5c534361b3903611206305b03c3 Pick-to: 6.7 Change-Id: Idcf022283bff04f4c4ee260180d3f5cfd0e80034 Reviewed-by: Mårten Nordheim <marten.nordheim@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>
* QRestReply: use qt_ptr_swap instead of std::swapMarc Mutz2024-03-011-1/+1
| | | | | | | | | | | | qt_ptr_swap is our swap compile-time optimizer. It's faster because it hardcodes noexcept(true) and std::swap() must calculate it. Amends 9ba5c7ff6aa42c5701cf950d2137467a2d178833. Pick-to: 6.7 Change-Id: I1b5a326276bd30638ac9b6dcf597abb5e53ada00 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Documentation improvement in QHttpHeaders and REST classesJaishree Vyas2024-02-294-26/+23
| | | | | | | | | Language and some other improvisations Fixes: QTBUG-120028 Pick-to: 6.7 Change-Id: Id5a5544abf244de5cff83f0d795732595934bd36 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QNetworkRequest attribute support to QNetworkRequestFactoryJuha Vuolle2024-02-283-0/+105
| | | | | | | | | | [ChangeLog][QtNetwork][QNetworkRequestFactory] Add QNetworkRequest attribute support to QNetworkRequestFactory Fixes: QTBUG-122397 Change-Id: Ie73f104cdad9f8f0721d8ee28f79095bfb04fb3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Http2: handle empty hpack block for headersMårten Nordheim2024-02-271-12/+21
| | | | | | | | | | | | | | | | When adjusting handling for the special traling HEADERS with PRIORITY case the actual no-headers case handling was lost. This patch adds it back. Now it deals with it being empty due to overflow or just empty headers. With a real server this should never happen though, since they either send the required headers or don't send a HEADER frame at all. So, in theory it will not have caused a problem for users. Pick-to: 6.7 6.6 Change-Id: Iacbb1183f26cb1f2e7e30ace6456488c4671972d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Containers: add max_size()Giuseppe D'Angelo2024-02-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more method for STL compatibility. This one is particularly subtle as it's required by the `reservable-container` concept: https://eel.is/c++draft/ranges#range.utility.conv.general-3 Without this concept, ranges::to won't reserve() before copying the elements (out of a sized range which isn't a common_range). Implementation notes: there were already a couple of constants denoting the maximum QByteArray and QString size. Centralize that implementation in QTypedArrayData, so that QList can use it too. The maximum allocation size (private constant) needs a even more central place so that even QVLA can use it. Lacking anything better, I've put it in qcontainerfwd.h. Since our containers aren't allocator-aware, I can make max_size() a static member, and replace the existing constants throughout the rest of qtbase. (I can't kill them yet as they're used by other submodules.) [ChangeLog][QtCore][QList] Added max_size(). [ChangeLog][QtCore][QString] Added max_size(). [ChangeLog][QtCore][QByteArray] Added max_size(). [ChangeLog][QtCore][QVarLengthArray] Added max_size(). Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change QRestAccessManager executeRequest() to use function_refJuha Vuolle2024-02-272-27/+30
| | | | | | | | | | | Drop the templated executeRequest functions in favor of qxp::function_ref for readability and type safety. Pick-to: 6.7 Task-number: QTBUG-122018 Change-Id: I36c07ff5fe6d2025459fe3f7190bc29901a320ce Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add space character when combining QHttpHeaders values with commaJuha Vuolle2024-02-271-5/+5
| | | | | | | | | | | | | | The "HTTP RFC 9110 5.3 Field Order" states that the values combined with comma can be followed up by an optional whitespace, and for consistency recommends "comma SP". This is also what eg. 'MDN Web Headers' class does. Fixes: QTBUG-122650 Pick-to: 6.7 Change-Id: I3391c86018090f0b8721929b64a7e3029e98ac85 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>
* QHttp2Connection: add extra docsMårten Nordheim2024-02-212-4/+312
| | | | | | | | And move a public slot into private slot, because it was not intended to be public. Change-Id: I847fa510c29e5f63aaace0797c81b9874007fda0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Mark the REST enablers as Tech PreviewGiuseppe D'Angelo2024-02-202-2/+2
| | | | | | | | Change-Id: Ie49a447f0f885290d43a7e4ecb0e0754df0da3e3 Pick-to: 6.7 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QHttp2Connection: confirm successive remote stream IDs are higherMårten Nordheim2024-02-192-5/+8
| | | | | | | | | | And it should also apply to the promised streams, not separate ID tracking. https://datatracker.ietf.org/doc/html/rfc9113#section-5.1.1 Change-Id: I6826a39c98f9b6a585200e628533843db731a85b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* QHttp2Connection: fix potential streamId reuseMårten Nordheim2024-02-191-1/+2
| | | | | | | Pick-to: 6.7 Change-Id: Ib81058c4613820f15f55388b87433875c11492dd Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Inline old QNetworkAccessManager transferTimeout int overloadsJuha Vuolle2024-02-142-8/+16
| | | | | | | | | | | | Qt 6.7 introduced new std::chrono variants of the transfer timeout functions. We can now inline the old 'int milliseconds' functions to reduce the number of DLL entry points when one isn't needed. Task-number: QTBUG-122023 Change-Id: I18e0ed424fa4da1dde67c811e0f3744edf24b5f8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Inline old QNetworkRequest transferTimeout int overloadsJuha Vuolle2024-02-142-8/+19
| | | | | | | | | | | Qt 6.7 introduced new std::chrono variants of the transfer timeout functions. We can now inline the old 'int milliseconds' functions to reduce the number of DLL entry points when one isn't needed. Task-number: QTBUG-122023 Change-Id: Iedcb6d0035bc6c3f03b87de543e9b02937b755e6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Change type of internal locationHeader constexpr to QL1SVJuha Vuolle2024-02-081-1/+1
| | | | | | | | | QL1SV is what QNetworkReply::rawHeader() ingests, and also it's what QHttpHeaders::nameAt() returns. Pick-to: 6.7 Change-Id: I967416cf6f203fe0f0980ef7eae2de7efc6d5377 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unnecessary case-insensitive header name comparisonsJuha Vuolle2024-02-082-10/+6
| | | | | | | | | | HTTP header name fields are case-insensitive and the QHttpHeaders class stores them as lower-case. Therefore the case-insensitive comparisons, when comparing against a lower-case value, are not needed. Pick-to: 6.7 Change-Id: I7f38ef16aa7c61103abc4c81c13aebdd6e535dc8 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace QHttpHeaders::toListOfPairs() usage with iterationJuha Vuolle2024-02-083-20/+26
| | | | | | | | | | | | ... as a more computationally effective way, which was not present at the time those usages were introduced. As a drive-by add spaces around a binary operator Task-number: QTBUG-122017 Pick-to: 6.7 Change-Id: I0528c995d1a3c1fe171486c5c313697d1706ee10 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add QNetworkRequestFactory::(set)?PriorityMårten Nordheim2024-02-083-0/+36
| | | | | | | | | To enable setting a default priority for all requests to a given site. Fixes: QTBUG-121669 Change-Id: Icd8a9c59e4afb0432c65f84cc8115ae0c7f85506 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Make QNAM handle all informational HTTP repliesMate Barany2024-02-061-1/+2
| | | | | | | | | | | | | | | | | | | Make QNetworkAccessManager to discard all informational (1xx) replies from HTTP servers with the exception of 101. According to RFC 9110: "A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses." Status code 101 is an exception because we use it to upgrade to http2 cleartext when it is enabled. Fixes: QTBUG-108068 Change-Id: I415ff053180a43f0c7ff1b4b2a60fd114ce08ac9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add missing QRestAccessManager constructor documentationJuha Vuolle2024-02-061-0/+8
| | | | | | | | Pick-to: 6.7 Fixes: QTBUG-121859 Change-Id: Ie8d9033a8efe36767f47509afe1a46c788cb13ca Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add missing QHttpHeaders::isEmpty() documentationJuha Vuolle2024-02-061-0/+8
| | | | | | | Pick-to: 6.7 Change-Id: Ib0d19cabc09d96b3920ade3db4d46b0bb0a6decb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Change QNetworkRequest/Reply rawHeader functions to take QASVJuha Vuolle2024-01-305-11/+12
| | | | | | | | | | | | | | | | | QHttpHeaders uses QASV for the header name field, and this aligns these functions with that. Furthermore having QASV as a parameter will allow a wider range of string types to be passed as a parameter (convenience). Resulted from API-review Amends: 56bb4ac484adb544925b6d7b58e4fd1d77d49503 Pick-to: 6.7 Change-Id: Iff42b75393b6470a2c34a1913dbe615bf21238db Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Take QJsonDocument as a parameterJuha Vuolle2024-01-303-93/+23
| | | | | | | | | | | Instead of separate QJsonObject and QJsonArray types. Resulted from API-review Pick-to: 6.7 Change-Id: I977d692d3709a8c3aa872683ddda54a143c25e67 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rename QRestReply data accessors as read* functionsJuha Vuolle2024-01-302-12/+12
| | | | | | | | | | | | 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>
* Http2: don't barf on > 4GiB cumulative headersMarc Mutz2024-01-291-2/+2
| | | | | | | | | The only user of the vector passes begin()/end() to BitIStream, which appears to be 64-bit-clean. Pick-to: 6.7 Change-Id: I4ad0b9e9547008fecc4c816cc92ff9db4b2066e3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Update QRestAccessManager documentationJuha Vuolle2024-01-292-107/+63
| | | | | | | | | | | | To accommodate the deduplication and non-owning changes in previous commit. Resulted from API-review Pick-to: 6.7 Change-Id: I61eb071503d6714c7fd42b3fe533698a8dcd2e27 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@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-296-443/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move WellKnownHeaders code to topJuha Vuolle2024-01-291-35/+35
| | | | | | | | | | Small rearrangement to make diff on later variant/union commit more readable Pick-to: 6.7 Task-number: QTBUG-119002 Change-Id: I3f6120b5dcd324b6493072d2eb58209866fb7dc6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unused include from qrestaccessmanagerJuha Vuolle2024-01-271-4/+0
| | | | | | | | A leftover, the class used to have some SSL functionality. Pick-to: 6.7 Change-Id: Ie987fe086b3e7e5583a9e69dd80e670b131d2832 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QHttpHeaders: make default ctor non-allocatingMarc Mutz2024-01-262-15/+36
| | | | | | | | | | | | | | | ... by allowing d == nullptr to mean the empty state. Needed to add a few guards and specialize QESDP::detach() to be able to detach from nullptr. This also gets rid of the partially-formed moved-from state. It's now guaranteed to be empty. Pick-to: 6.7 Change-Id: If874d7c69d91eb4babe667ae577f261610d52fd3 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QHttpHeaders: Self-Encapsulate Field d->headersMarc Mutz2024-01-261-4/+4
| | | | | | | | | Use QHttpHeaders::reserve() and QHttpHeaders::isEmpty() instead of going directly to d->headers. Will help in enabling a nullptr d. Pick-to: 6.7 Change-Id: Id530f8922b17058ec47530523ed43e08927c3ce3 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QHttpHeaders: add a missing detach()Marc Mutz2024-01-261-0/+1
| | | | | | | | | | | Before calling a mutable member function (in this case, QList::reserve()) on one of the Private members, we need to ensure exclusive ownership of our external state, otherwise we have a Data Race, because QList::reserve() is not thread-safe (only re-entrant). Pick-to: 6.7 Change-Id: I1249de9449865cbf6ab519b0d38b3bf4e743f16d Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QHttpHeaders: move verify() into public classMarc Mutz2024-01-262-16/+15
| | | | | | | | Prepares for d == nullptr. Pick-to: 6.7 Change-Id: Ie338f1635d64076d2d2b387fe0de8b3b1a8d0386 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Http2: fix 401 authentication required w/o challengeMårten Nordheim2024-01-251-0/+11
| | | | | | | | | | | | | The code did not handle the path where we didn't have a challenge. We cannot recover from that so we just have to fail the request. Amends fe1b668861e8a3ef99e126821fcd3eeaa6044b54 Pick-to: 6.7 6.6 6.6.2 6.5 6.2 Fixes: QTBUG-121515 Change-Id: Ie39a92e7439785a09cad28e8f81599a51de5e27f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Doc: Qt Network: Fix references to renamed functionsTopi Reinio2024-01-252-15/+15
| | | | | | | | | | | | | | | | As part of the API review process, in QNetworkRequestFactory: (set|clear)Headers() were renamed to (set|clear)CommonHeaders(), and request() was renamed to createRequest(). In addition, QHttpHeaders::has() was renamed to contains(). Update references to the old names in the documentation. Pick-to: 6.7 Change-Id: Ib79ae99de26be2f3af60787c8b86c3c20cb30067 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* 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>