summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-293-131/+92
| | | | | | | | | | | | 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>
* Handle EWOULDBLOCK the same way as EAGAIN when writing to sockets on UnixŁukasz Matysiak2024-01-281-0/+3
| | | | | | | | | | | | | | | On most platforms EWOULDBLOCK is defined to be equal to EAGAIN. However on some platforms (like VxWorks) it is not the case. Because of that, error returned from ::write is not handled properly on such platform. Since C++ does not allow duplicate switch labels, check if EWOULDBLOCK and EAGAIN have different values before adding EWOULDBLOCK to the switch statement. Task-number: QTBUG-115777 Pick-to: 6.7 Change-Id: I659cb946f239733f5c57b2000fb4e3d296ed9153 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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-2520-96/+83
| | | | | | | | | | | | | 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>
* QSsl: QMetaObject is defined in qobjectdefs.hMarc Mutz2024-01-231-1/+1
| | | | | | | | | | | | | | | | | ... not in qmetaobject.h. Don't include more than we need. Found in API-Review. Amends b856790d67ad25f5cd8e374cb299a129acbea2ff. [ChangeLog][QtNetwork] The enums in namespace QSsl are now Q_ENUMs. Pick-to: 6.7 Change-Id: I67ec107ce5ab266cfad8a628e7ba3496d2484766 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QHostInfo: fix lookupHost() signature immediatelyMarc Mutz2024-01-233-2/+18
| | | | | | | | | | | | | | | ... and not just for Qt 7. Found in API-Review. Amends dd50d58af267bd3b79d1ca31b920d72b925d5a37. [ChangeLog][QtNetwork][QHostInfo] The lookupHost() static function now takes const QObject* receivers (was: (non-const) QObject*). Pick-to: 6.7 Change-Id: I22b11e06cfba4e96975239cabed8b379cf3f4fa4 Reviewed-by: Mårten Nordheim <marten.nordheim@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>
* Fix accidental implicit QBA->QString conversionMårten Nordheim2024-01-182-4/+4
| | | | | | | | | | And make sure it cannot happen again by adding the QT_NO_CAST_FROM_ASCII define to the Network module. Amends 5346404da64ac87d161f510d9fee71899d7c70ba Change-Id: Ib10d7822c514caaf40b6b36ee71947c034daf338 Reviewed-by: Ivan Solovev <ivan.solovev@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>
* Remove the use of GENERATE_PRIVATE_CPP_EXPORTS argumentAlexey Edelev2024-01-171-1/+0
| | | | | | Task-number: QTBUG-117983 Change-Id: Ic12e6c9daedd56f54cbde20e6bebd19f8420604c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Privately introduce QHttp2ConnectionMårten Nordheim2024-01-175-13/+1790
| | | | | | | | | | | | | | | 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>
* Fix missing certs directory in VxWorksMarcin Zdunek2024-01-161-1/+14
| | | | | | | | | | tst_qsslsocket checks for system CA certificates, which VxWorks doesn't have out of the box, which causes a lot of testcases to fail. As VxWorks doesn't provide default directory structure, directory with ssl certs is provided by setting a variable. Task-number: QTBUG-115777 Change-Id: I5c93933ee5fbcafd6ffd76b574d8793fe75dbdbc 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-123-12/+12
| | | | | | | | | 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-124-49/+13
| | | | | | | | | | | 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>
* Fix QThreadPool::maxThreadCount() usageIvan Solovev2024-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | The docs claim that QThreadPool always creates at least one thread. However, the user can (usually by mistake) request zero or a negative number of threads. The maxThreadCount() function is simply returning the value, that was requested by the user. Since it's a public API, it is used in several places in QtConcurrent, where it is assumed that the value is always positive. This can lead to a crash if the user sets zero as a maxThreadCount. Update all such places with std::max(maxThreadCount(), 1). Prefer this approach over changing the return value of maxThreadCount(), because its behavior is documented and tested. Amends 885eff053797d56f2e295558d0a71b030fbb1a69. Fixes: QTBUG-120335 Pick-to: 6.7 6.6 6.5 6.2 Change-Id: Id3b2087cec7fbc7a2d42febca6586f2dacffe444 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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-224-9/+8
| | | | | | | 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>
* Enable IPv6 tests for VxWorksKrzysztof Sommerfeld2023-12-151-2/+2
| | | | | | | Task-number: QTBUG-115777 Pick-to: 6.7 Change-Id: I1ec9cda2f9fc72bf539e75fa7144d9b4b97d7369 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove qDeleteInEventHandlerTor Arne Vestbø2023-12-141-3/+3
| | | | | | | | | | It's equivalent to delete these days, and has been for a long time, since 2011 in fact, when the last remnants of QT_JAMBI_BUILD were removed. Change-Id: I7703e41c04204844da4ee75fa251b361e0db4ead Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@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>