summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Port QtNetwork from QStringRef to QStringViewLars Knoll2020-06-1010-34/+34
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I0f4e83c282b58ab4cc5e397b21981978f79d92cf Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove accidental leftover debug printoutMårten Nordheim2020-06-101-1/+0
| | | | | Change-Id: I1de2f1dfd8ba4a19049ef96d85cf15206510410d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QNetworkInterface (Unix): port two local tracker (QSet/QLVA) to ↵Marc Mutz2020-06-081-10/+9
| | | | | | | | | | | QDuplicateTracker Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: I025504c7d22fb7a8c943e3968e4613d45c08d0b3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSsl: port a local QStringList to QDuplicateTrackerMarc Mutz2020-06-081-4/+5
| | | | | | | | | | | | Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. The code is the first user of the collected data, so make that available by adding QDuplicateTracker::appendTo(Container&) methods. Change-Id: Ibd8810c0070db7e6b3ead6d6a569facdab88b646 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: add missing PatternSyntax documentation to QSslCertificateSamuel Gaist2020-06-071-0/+18
| | | | | | | | | | | This patch adds the missing documentation for the new QSslCertificate PatternSyntax enum which replaces the one from QRegExp. Fixes: QTBUG-84464 Pick-to: 5.15 Change-Id: Icf092f42ad4dff9207ca51dfd8b4fb8ed6443ff2 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove winrtOliver Wolff2020-06-0632-3726/+47
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtNetwork remove deprecated signalsTimur Pocheptsov2020-06-049-64/+1
| | | | | | | | | | Use 'errorOccurred' instead of 'error' and 'sslHandshakeErrors' instead of 'sslErrors'. Fixes: QTBUG-82605 Change-Id: I19d4845b16c7b636af7b0658d4fbbba4eef9d029 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNetworkReplyHttpImpl: resolve a todo after the bearer removalMårten Nordheim2020-06-042-24/+3
| | | | | | | | | | | Not quite "next commit" like I wrote originally, but better late than never. As the comment said (and the code shows) it only returns true now so the extra function and if-check isn't needed anymore. Change-Id: I9e8fb8891a116475ab78c3848d7cfcdb659ac521 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* H2 protocol handler: make sure inflateEnd gets called on z-streamTimur Pocheptsov2020-06-031-0/+3
| | | | | | | | | | | | | | | The request/reply pair is created out of QNetworkRequest, we set autoDecompress data-member on the request, but not reply. As a result, reply in its destructor fails to release memory, allocated by z-lib (by failing to call inflateEnd). Since with H1 requests it does not seem to be a problem (no leaks detected), I'm limiting this change to H2 handler only. Later it will be retired by the stream decompression change in Qt 6, but will be picked to 5.15. Fixes: QTBUG-84560 Pick-to: 5.15 Change-Id: I82e19d2b0a83624b730edd20d7d45721e7001731 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* MetaObject: Store the QMetaType of the methodsFabian Kosmale2020-06-0210-6/+22
| | | | | | | | | | | | | | | | | | | | | | | | This does the analog of 46f407126ef3e94d59254012cdc34d6a4ad2faf2 for the methods we care about (signals, slots, Q_INVOKABLEs). In addition to the actual QMetaType, we store an array with offsets so that we later can do a mapping from methodIndex to metatype. The newly added QMetaMethod::{return,parameter}MetaType methods can then be used to retrieve the metatypes. This does however require that all involved types are complete. This is unfortunately not a feasible requirement. Thus, we only populate the metatype array on a best effort basis. For any incomplete type, we store QMetaType::Unknown. Then, when accessing the metatype, we fall back to the old string based code base if it's Unknown. Squashes "moc: support incomplete types" and "Fix compile failures after QMetaMethod change" Fixes: QTBUG-82932 Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Convert Q_ASSERT to Q_STATIC_ASSERTDimitrios Apostolou2020-06-021-1/+1
| | | | | | | | This is now possible because of the earlier commit that changed the const arrays in qurltlds_p.h to constexpr arrays. Change-Id: I37a6a64e250bbe33f7d34b5916595bf6a37aed4a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Regenerate rest of configure.cmake filesAlexandru Croitor2020-05-291-6/+6
| | | | | | Change-Id: I17cca57c18f33d4283eb6009ba4c5ebb0c1847c3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CA fetcher (Windows) - relax the logic a bitTimur Pocheptsov2020-05-298-58/+252
| | | | | | | | | | | | | | | | | | | | | In case a certificate chain is missing an intermediate, for a certificate having "Authority Information Access" extension it's possible to fetch this intermediate and build the chain up to the trusted root. Unfortunately, it's not always possible to install the root certificate in the system "ROOT" store and then an application wants to set it in the socket's configuration, using setCaCertificates(). But this call also disables CA fetcher ('no on demand root loading'). It makes sense to relax this logic for such certificates and try to fetch the intermediate CA and then have the complete chain verified. Pick-to: 5.15 Fixes: QTBUG-84173 Change-Id: I5b9b4271767eba6f5fd2b5cf05e942360c6aa245 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Address Coverity defect about buffer overrunDimitrios Apostolou2020-05-281-3/+23
| | | | | | | | | | | | | | | | Coverity warned that chunk could be >= tldChunkCount (2), and tldData[chunk] (array of length 2) would be accessed out of bounds. This can not happen, but it was unclear. Clarify logic with comments and asserts, that Coverity will hopefully understand now. Change-Id: I2a38c685cfcbc69ed123918e8cbed360b20b1035 Coverity-Id: 178254 Pick-to: 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Regenerate qurltlds_p.hDimitrios Apostolou2020-05-281-13868/+13941
| | | | | | | | | | With the recent changes in the utility that generates it, it now has improved readability and constexpr arrays, usable in static asserts. It also has an updated list of TLDs. Change-Id: Ibdc986d667feebeb141ff81f6fddbc05b6be8488 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QNetworkReplyFileImpl: Fix typoMårten Nordheim2020-05-271-1/+1
| | | | | | | | Causes emission to not happen and prints a warning Pick-to: 5.15 Change-Id: Ie80cc89549741079c243e6fd4269f793bccca9fd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix deprecation warning by not going through QCharVolker Hilsheimer2020-05-251-2/+2
| | | | | | | | | mValue is a QByteArray, so no need to expand data to UTF16 just to compare it to a Latin1 character. Change-Id: Ib3c8770867cd5509bb4c2ac5e45aabca577b3bba Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* wasm: set status codes from network operationLorn Potter2020-05-252-9/+20
| | | | | | | Pick-to: 5.15 Fixes: QTBUG-83991 Change-Id: Ie1e88189bee8b6a9dc6cb2a721777a5e1032307a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix heap crash when making multiple network callsLorn Potter2020-05-252-20/+23
| | | | | | | Pick-to: 5.15 Task-number: QTBUG-83991 Change-Id: I354934b53799f3eeb958395932bed18289b1e279 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QSslCertificate: overhaul ASN.1 datetime parsingGiuseppe D'Angelo2020-05-222-45/+60
| | | | | | | | | | Instead of manual string splitting (EW!), use QDateTime parsing. Moreover, X.509 certificates *must* have a valid start/end date. In case of parsing failure, reject the certificate. An autotest for this last case is coming in a separate patch. Change-Id: I934bf9e6a4a92e4befdb3b0f9450f76f67bad067 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add missing overrideAlexander Volkov2020-05-211-1/+1
| | | | | | Change-Id: I88000e82ecbdc55e621dc8e22aff5e8f55cf9d0e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSslSocket::addCaCertificates - do not duplicate certsTimur Pocheptsov2020-05-201-2/+2
| | | | | | | | | If we already know the certificate, there is no need in adding it again. This function is deprecated, but will stay forever in 5.15. Pick-to: 5.15 Change-Id: I760f5bcffea78ac02c5643ee1112725edd32f15a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make OpenSSL back-end work with 3.0 alphaTimur Pocheptsov2020-05-206-20/+112
| | | | | | | | | | | | | | DSA/DH/etc _bits functions were first deprecated, then un-deprecated, so we don't worry about them for now. SSL_CTX_load_verify_location was deprecated and two new functions were introduced instead (one using file, the second - path). It's unfortunately 3.0 only, so we have to check OpenSSL version. DH_check is deprecated and we have to use EVP_PKEY_param_check with tons of a boilerplate code around. Fixes: QTBUG-83733 Pick-to: 5.15 Change-Id: Icd401ab6aad30c23c37443c7bc82c702fb843640 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Sweep Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 -> Q_DECLARE_SHAREDMarc Mutz2020-05-192-2/+2
| | | | | | | | | | | | This is Qt 6, so Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 is the same as Q_DECLARE_SHARED. Let's hope we'll collectively get better at detecting missing Q_DECLARE_SHARED so we won't need a Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT7 in the future. Change-Id: I3da9faff4c66b64a3b257309012a2a10a6c6d027 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Generate information about 3rdparty libs in module .pri filesJoerg Bornemann2020-05-191-4/+4
| | | | | | | | | | | | | For modules that are not yet ported to CMake and that use QMAKE_USE += libfoo we need to provide the information about libfoo in the qt_lib_XXX.pri files. Also, we now generate qt_ext_XXX.pri files for bundled 3rdparty libs. Task-number: QTBUG-75666 Change-Id: I9e4b057a197554ecb37c294c0bf09e2a2b3aa053 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QAuthenticator: Reprioritize authentication methodsMårten Nordheim2020-05-191-1/+1
| | | | | | | | | | | | | | | | | | | The addition of Negotiate to QAuthenticator caused a soft sort of regression in environments where there is key distribution center set up. This was due to how QAuthenticator works in that it will simply prefer the latest entry in the enum, which now was Negotiate, which sadly wasn't really a valid option in that situation. And it is not smart enough to fall back and try another method. To work around this issue we re-order the enum to prioritize authentication methods to restore previous behavior. Note that Negotiate is still preferred over Basic and None because they're not likely to appear together. Pick-to: 5.15 Task-number: QTBUG-83905 Change-Id: Ic528318b6b711aa04d42a86c684452bb6ebde112 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkReply: Remove some bearer management leftoversMårten Nordheim2020-05-155-113/+3
| | | | | | | | migrating backend was done if the QNetworkSession changed. With QNetworkSession gone this was no longer called from anywhere. Change-Id: I8c995001f9d4c7ae83446b4d29fa62c954c79889 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove deprecated QDesktopServices APIsVolker Hilsheimer2020-05-131-1/+1
| | | | | Change-Id: Ic21ad2938b20c1aa3ae499a921c9cff92f615816 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CA fetcher - do not add CA root if it's already presentTimur Pocheptsov2020-05-111-0/+2
| | | | | | | | | | | As it was found recently CA fetcher, while building a chain with a missing intermediary, may return the root we are already aware of (had in the "ROOT" store). While this is in general harmless, it can be a bit surprising if some code is analyzing the list of CA certificates after a handshake. Pick-to: 5.15 Change-Id: I1df3b537e2a812de17e2c94ad4643cf36e7e946f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSslSocket::setSslSonfiguration - set d.configuration properlyTimur Pocheptsov2020-05-081-1/+3
| | | | | | | | | | | | | | We end up with an absurd situation: QSslConfiguration conf; //we set CA certs so that on demand loading is disabled: conf.setCaCertificates({...}); QSslSocket s; s.setSslConfiguration(conf); Q_ASSERT(conf == s.sslConfiguration); // this assert fails. Pick-to: 5.15 Change-Id: I272bed145434082acc6ead95fe3640d222b21131 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Enable warnings-are-errors also for snippetsKai Koehne2020-05-071-0/+2
| | | | | | Pick-to: 5.15 Change-Id: I6b3645924e4f090c7887ce0d6296a71dc8f8159d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add a QRegularExpression::fromWildcard() convenience methodLars Knoll2020-05-062-4/+2
| | | | | | | | | Simplify constructing QRegularExpression objects from a glob pattern. Change-Id: I06f60b1dfea3da969e2474dedd44b6ca5d456d7d Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-047-7/+21
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/text/qlocale.cpp src/network/access/qnetworkaccessmanager.cpp Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
| * QNAM: Don't check if a session is needed for a cache lookupMårten Nordheim2020-04-302-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | QNetworkAccessCacheBackend didn't override the virtual start() function which then deferred to QNetworkAccessBackend::start() which conditions its success on whether or not a network session is available. Override the function and reimplement it without the network session check. Fixes: QTBUG-83205 Change-Id: I45d98a6f5da8ad04bb9da551a131f109e83074d7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * QAuthenticator: make sure we load the SSPI libraryMårten Nordheim2020-04-301-1/+7
| | | | | | | | | | Change-Id: Iac371065dfc20ad5920889be66c8282a45c5805e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Merge "Merge remote-tracking branch 'origin/5.15.0' into 5.15"Liang Qi2020-04-292-4/+5
| |\
| | * Merge remote-tracking branch 'origin/5.15.0' into 5.15Liang Qi2020-04-282-4/+5
| | |\ | | | | | | | | | | | | Change-Id: I42afd73badf41ac990ff9cf8c6bc650850d2dacf
| | | * Doc: Remove manual duplicate alias descriptionsPaul Wicking2020-04-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the introduction of the \typealias command to QDoc, QDoc generates a standardized line for aliased types. This patch removes duplication caused by the change in QDoc. Change-Id: I1a01c378f85b0decb7c0400a3b21146f0898c6ec Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| | | * Fix 32bit int overflowAllan Sandfeld Jensen2020-04-271-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not continue if the conversion to 32bit int would cause an overflow. Change-Id: I8a198dce5962e7ebd248b9baa92aba8730bfd3b0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | | * Merge remote-tracking branch 'origin/5.14' into 5.15.0Liang Qi2020-04-221-0/+2
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3a6d8df5219653b043bd642668cee193f563ec84. That change is only for 5.14. Conflicts: src/plugins/platforms/wasm/qwasmeventtranslator.cpp src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmopenglcontext.cpp src/plugins/platforms/wasm/qwasmscreen.cpp Change-Id: I2d845c795a683e1542201cfb6fdd185fec2b17ab
| * | | | wasm: fix network download crashLorn Potter2020-04-291-1/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems it was defaulting to the indexdb filesystem, but it is not mounted. Fixes: QTBUG-83827 Change-Id: I1f81d790e5786fe41b59c0f41ca7f6025732c9b2 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
| * | | QNAM/QNetConMon: emit networkAccessibleChanged on changesMårten Nordheim2020-04-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For compatibility with the bearer functionality. Change-Id: I26ba6bad046b3f99c8ee13e709a26ddcbd868e25 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | | QNAM/QNetConMon: Update handling of QNetworkConnectionMonitor::startMårten Nordheim2020-04-302-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QNetworkConnectionMonitor::start was previously called after checking d->networkAccessible, unfortunately that means if the network was unavailable when QNetworkConnectionMonitor was created we don't subscribe to updates or recheck the status (unless QNetworkAccessManager::networkAccessible() is called). Move the call to start to before the offline check. Also update the Windows backend so that it updates networkAccessible on the call to start() Pick-to: 5.15 Change-Id: I37647f19f703947143e7cbdafe09619ce0d98cc1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* | | | QNetworkProxy: don't allocate when parsing [1/2]: loop bodyMarc Mutz2020-04-291-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of manipulating a QByteArray, do it with a QLatin1String, which is free. Also, don't prepend a dot to force matches at label boundaries, check that there's a dot where the match occurred. Saves two allocations per iteration. Finally, pull the query's peerHostName() initialization out of the loop - it doesn't depend on the loop variable. Change-Id: I6dfdae711f0bd8941af69bfbcfda7873a40e4b80 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | | QtNetwork: fix a few more char -> QChar conversionsMarc Mutz2020-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They were masked by all QChar ctors being made explicit, except the char16_t one, which was left as the only viable choice. Change-Id: I7288e6ae32b2771859a61c0b99783209d47616bc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | | Remove unused qTopLevelDomain()Marc Mutz2020-04-272-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The last (and only) user was removed in 4f076db3d2e2e27cc56029fe878056ee79def56f. Change-Id: I59b155017bfd00bbcbfe72dc0e535c92c0384dad Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | | Port qIsEffectiveTLD() to QStringViewMarc Mutz2020-04-263-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also add a piece of documentation that the input needs to be in lower-case (the implementation uses qt_hash to index into a table of TLDs, and qt_hash is case-sensitive). Change-Id: I911c0e2bb0826fc1b0fc01ed60bdfd6e4c0298f2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-231-0/+2
|\| | | | | | | | | | | | | | | Change-Id: Iaa439ba7dff19a17e3716b3d30f49f60fa6e38f8
| * | | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-04-221-0/+2
| |\ \ \ | | |/ / | |/| / | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3a6d8df5219653b043bd642668cee193f563ec84. That change is only for 5.14. Conflicts: src/plugins/platforms/wasm/qwasmeventtranslator.cpp src/plugins/platforms/wasm/qwasmintegration.cpp src/plugins/platforms/wasm/qwasmopenglcontext.cpp src/plugins/platforms/wasm/qwasmscreen.cpp Change-Id: Ib9151e199291fe6eb4151027b515393c05303d65
| | * QAuthenticator: Reset the authentication challengeMårten Nordheim2020-04-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both Negotiate and NTLM are conditioned on the 'challenge' being empty when starting the authentication process. So let's reset it when we start the authentication process. Fixes: QTBUG-83370 Change-Id: I41af6d5bcfe3dd980ca2bedce10ceff4f61047ff Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>