summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-1610-50/+115
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I0cdb390124e783dc9cd832a9954baa76a0e9eb6b
| * QLocalSocket: fix inclusions in namespaced buildsGiuseppe D'Angelo2021-05-311-1/+4
| | | | | | | | | | | | | | | | | | | | An include statement appeared after opening the Qt namespace, thus injecting symbols in there. Move it outside. Change-Id: I8e95e821b36ad4e4ceed5b0645bf8ebf7e531e06 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 99e95a2cc6ddec5ebd7f69489811be2e9aef98b9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QSpdyProtocolHandler: don't rely on device being availableMårten Nordheim2021-05-201-1/+2
| | | | | | | | | | | | | | | | The device is not necessarily available so don't assert on it. This is due to having the slot connected by QueuedConnection. Change-Id: Ic957d4d7d0c6e3fc580c056b9984df9ca728e363 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * QSsl: fix UB pointer useTimur Pocheptsov2021-05-042-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | Weird macro had inverted notion of type safety: instead of casting parameters and return values (they are pointers) to work with generic OPENSSL_sk_xxx functions, it was ... casting a function pointer to an invalid type to get ... nothing, but UB. Home-brewed (un)'safestack'!!! Change-Id: Ib91a7ba4cd472f370836797e422456f91a4385b0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 9fc2f1f076b953ff0979fb73ed6e70ac9bde278c)
| * HTTP/2 authentication requiredMårten Nordheim2021-05-035-29/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With Qt 6 we made HTTP/2 default, which exposed missing handling of 401 Unauthorized (and 407 Proxy Authentication Required). In HTTP/1.* we would handle this after the response had finished, while handling the status code. For h2 this path isn't used since it is heavily reliant on the structure we have for HTTP/1.* (one request per channel). So we must handle the status code and header directly. Having that part fixed exposed another issue - when resetting/rewinding uploaded data we were not resetting the 'totallyUploadedData' counter in the reply (this, in turn, exposed another small issue). Because of that we did not actually send any data on the retry, only sending the content-length followed by no data. Finally, the small issue mentioned in the previous paragraph was how we check if we have uploaded all our data. It was only checking if the byte-device was atEnd(), which it was. But only because it had not yet prepared any data for us. Fixes: QTBUG-91284 Change-Id: I798d105b02688b18a02897cc476f19f57a47f98f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 52a0eb4791727157a7b385f7e022faad28da4821)
| * QNetworkDiskCache: Drop the file mmap-ingMårten Nordheim2021-04-211-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Presumably the code at some point would do a QByteArray::fromRawData-style thing. But now it doesn't do that so the current code was a bit strange. It would map the content of the file to memory only to then copy the content into a QByteArray. Then it reparents the file to the QBuffer, keeping it alive even if its not needed. Fixes: QTBUG-92838 Change-Id: I88f8cd1b64e0fd13d08b5cc4df44661e216da340 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit c254d73be63033497838807119cb9cb47ca6c1fa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into ↵Tarja Sundqvist2022-04-072-7/+5
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I3d223d54a832c8365fec4b399550da79f4c1abbb
| * QLocalSocket/Win: fix possible UB in _q_pipeClosed()Alex Trotsenko2021-04-091-5/+2
| | | | | | | | | | | | | | | | | | | | We must stop the pipe writer before closing the handle on which it operates. Change-Id: I4765dd8393167fe2453653aba76a097b8ace8e3d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 64f02ebf05d88eaa8399a5cff85db5a605ede62e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QAsn1Element: Avoid overflow in QAsn1Element::toIntegerRobert Löhning2021-03-191-2/+3
| | | | | | | | | | | | | | | | | | | | Fixes oss-fuzz issue 29534. Change-Id: I51d0b8238c73e5860c40d3b74577ddb8926647a3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 11a3eab1e168256778c45090b56e998e50c08c55) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Revert "Update commercial license headers to src/dbus, src/gui, src/network"Tarja Sundqvist2021-03-22272-5563/+5563
|/ | | | | | | | | | | This reverts commit 897645d417c445f19ee183147c61e1bd0694868f. Revert of commercial license header changes is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I4b21b5e105d34dc076a5ffad1a6d3b2793c2f163 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Schannel: Fix incomplete downloads with read buffer restrictedMårten Nordheim2021-02-173-1/+5
| | | | | | | | | | | | | | | | | | | | When the read buffer has a max size we do our best not to exceed it. Usually there's no problem and we just read more when the next tcp frame arrives. However if there's data leftover after the last tcp frame arrived then we won't receive any more data. To counter this QSslSocket would try to invoke QSslSocketPrivate::transmit indirectly if there were any bytes available on the plain socket. The problem is that with Schannel the last few remaining bytes would not be in the plain socket, but in the 'intermediateBuffer'. So let's make QSslSocket aware of that. Fixes: QTBUG-90625 Change-Id: If56e4cce558f99c9a08a1f6818e005a887712ef2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Norbert Pfeiler <norbert.pfeiler+git@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 6d4da1340f18b66e60ed6969aeb7180e00d39077) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QNetworkInterface IsUp and IsRunning enum documentationAndreas Hartmetz2021-02-101-3/+5
| | | | | | | | | | | | | | | | The information is based on common Linux knowledge, StackOverflow answers (this is just one of them): https://stackoverflow.com/questions/11679514/what-is-the- difference-between-iff-up-and-iff-running an LKML thread about IFF_UP and IFF_RUNNING: https://lkml.org/lkml/1999/7/9/69 and the FreeBSD manpage for "ifnet" - e.g. https://www.freebsd.org/cgi/man.cgi?query=ifnet&sektion=9 Change-Id: I50a47b7fb26a63ac9d3f7eeef559fa7f56003cff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit e6bd5a5ca3f55765edccf7c667612fb0919e6c94) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSslCertificate::operator == - cleanup error queueTimur Pocheptsov2021-02-101-2/+9
| | | | | | | | | | Another case when an OpenSSL's call can dump some errors into the shared error queue discovered. An invalid certificate with non-null X509 * may result in several errors appended to the queue. Change-Id: I1278b371bd1edf2d656760c371bfb6da5dcab6ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 3bc398f76669c2532ae6e3f163f994feb7e6a0bf)
* QSsl: fix OpenSSL DLL names for Windows on ARMCameron Gutman2021-02-031-5/+9
| | | | | | | | | | | | OpenSSL adds an '-arm'/'-arm64' suffix to the DLL names when building for VC-WIN32-ARM or VC-WIN64-ARM. This needs to be accounted for in Qt to find the OpenSSL DLLs correctly. Fixes: QTBUG-89647 Change-Id: Ibc9b81e06f8e64c0676f335e13024fa7fe3a4fa3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit c111aad270f1d51c2e870ee25e9a6bba64b3cecc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSslCertificate: Guard against accessing empty QByteArrayRobert Loehning2021-02-031-1/+3
| | | | | | | | | Fixes oss-fuzz issue 29276. Change-Id: I57b0c26e5377bd6b82d9f044ae1d1d13acec996a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit ce90248882b73b4b816a8550710279e3e55ab64c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSslCertificate(OpenSSL) - harden protection against nullpointersTimur Pocheptsov2021-02-021-2/+25
| | | | | | | | | | | | An invalid (as input data) certificate may have non-zero number of invalid (nullptr) extensions (if OpenSSL failed to parse them, for example). Fixes: QTBUG-89547 Change-Id: I4b93ac9f482f850f02d01b0aea10560dc11b688d Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de> Reviewed-by: Alex Blasche <alexander.blasche@qt.io> (cherry picked from commit f31997448838902eb5237b567f0c80f423f2406e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update commercial license headers to src/dbus, src/gui, src/networkTarja Sundqvist2021-01-28272-5563/+5563
| | | | | | | | | | | | | | | | Updated header.COMM to files in tqtc-qtbase/src/dbus, tqtc-qtbase/src/gui and tqtc-qtbase/src/network. The documentation files were not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in tests. Task-number: QTQAINFRA-4154 Change-Id: Id2d3db63c1f378812d8058fa8a118702a5829eb8 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Http2: set the reply's error code and string on errorMårten Nordheim2020-12-091-0/+2
| | | | | | | | | | | | If the error occurs during the call to QHttpNetworkConnectionPrivate::queueRequest coming from the http thread delegate then we will not yet have connected to the signal! But the http thread delegate checks if the error code is not NoError, and handles those situations. To let that work we must update the replies. Change-Id: I47188e9439920694aaad1765ab28add1e86ccdff Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit b4d7908d5a623bd0024d290eee6e2226a627542d)
* QSslSocket::verify: do not alter the default configurationTimur Pocheptsov2020-12-072-6/+12
| | | | | | | | | | | | | | | | | | | QSslCertificate::verify() has an undocumented and not very desirable property - on some platorms it updates the default configuration, which can be surprising. For example, we deprecated QSslSocket::setDefaultCaCertificates() and recommend using QSslConfiguration::defaultConfiguration(), QSslConfiguration::setDefaultConfiguration(), and QSslConfiguration::setCaCertificates(). If an application does this to select CA roots it trusts explicitly, and then for some reason is calling verify, the application can have its QSslSockets successfully connecting to a host, whose root was not trusted by the application. Also, on Windows, defaultCaCertificates() include system roots already, no need to have them twice. [ChangeLog][QtCore][QtNetwork] QSslSocket::verify - do not change the default configuration Fixes: QTBUG-88639 Change-Id: I1cd40b259d0a6dcd15c78d1e7c027ff10859595c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 1158ff67b492853b72199ed78bfcf24132e1c7ff)
* QSslSocket: Don't call 'transmit' in unencrypted modeMårten Nordheim2020-12-042-1/+4
| | | | | | | | | | | At the same time I'll add a generic protection against being called in unprotected mode in the schannel backend (openssl already has it in a different form). Change-Id: I97c1be6239c27e306de0af7ad568fbcfde09da71 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit f8badeda72813ee4d32e7672c4a98373cb7b5d60) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Make sure that the reserved characters are not escapedAndy Shaw2020-12-041-1/+1
| | | | | | | | | | | | | The URL for the PAC proxy that is passed needs to be preserved for the main URL part and not entirely percent encoded, only the query part typically needs to be encoded. So use toEncoded instead for a URL to ensure they are not percent encoded. This amends c163ec1dbf873781b77ea67d4449d643c166c0c4 Change-Id: Ie41ab55f71be8e25c18775e61ce7b4d110c2ddbf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 94c3c7a491e0c25cf2179efe04c2fbd80b370c1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Http2: don't call ensureConnection when there's no request availableMårten Nordheim2020-12-031-1/+3
| | | | | | | | | | | | | | Previously we only checked if there was something in the h2 queue or if we had not yet switched to http2. These means in some cases that following an error it would enter this branch and, because it had not yet switched to http2, it would call 'ensureConnection' which would try start a reconnection. This could make the proxy socket engines try to emit 'auth required' with no replies, meaning nothing happens. Fixes: QTBUG-88417 Change-Id: If37b8c71ac36597adc305fb1b1ea4fa7b48b0d28 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit def1b9784958dbf4459618d15daeae69ed5af332)
* Http2: Remove errored-out requests from queueMårten Nordheim2020-12-031-0/+1
| | | | | | | | | | | | | | | | | | The requests will remove themselves once they get deleted but since the deletion is done through a _queued_ invokeMethod to 'deleteLater' we will call QHttpNetworkConnection::_q_startNextRequest first which may end up starting a reconnect of the TCP socket which we had the error on. In this specific instance it manifested as a race condition where we either don't get a proxyAuthorizationRequired signal at all (it was emitted while we didn't have any valid replies), or we get the signal emitted too late and it gets emitted on whatever the next reply was. Task-number: QTBUG-88417 Change-Id: If3f8ececc5550f1868c90124559cb8e3029646d8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 65bcac95a7a051d4343aaa3c5ff8b39494aa14e4)
* Fix exception with Android 5.xAndré Klitzing2020-12-031-1/+2
| | | | | | | | | | | | | | | ConnectivityManager#getDefaultProxy() is available in API Level 23. No pending exception expected: java.lang.NoSuchMethodError: No virtual method getDefaultProxy()Landroid/net/ProxyInfo; in class Landroid/net/ConnectivityManager; or its super classes (declaration of 'android.net.ConnectivityManager' appears in /system/framework/framework.jar) at android.net.ProxyInfo org.qtproject.qt5.android.network.QtNetwork.getProxyInfo(android.content.Context) (QtNetwork.java:98) at void org.qtproject.qt5.android.QtNative.startQtApplication() (QtNative.java:-2) at void org.qtproject.qt5.android.QtNative$7.run() (QtNative.java:620) at void org.qtproject.qt5.android.QtThread$1.run() (QtThread.java:61) at void java.lang.Thread.run() (Thread.java:831) Task-number: QTBUG-78812 Change-Id: I68c4cc97eea63eae53dfc2ee50bff658e5cd4a93 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QDtls - remove redundant RAII structTimur Pocheptsov2020-11-201-13/+1
| | | | | | | | | | | | As noted by LCOV, the part with q_BIO_free(bio) was never executed since we were taking the result from QScopedPointer before returning. While it's a what RAII idiom is for, there is quite a low probability that SSL_set_bio() one day will start throwing exceptions. Change-Id: Id24e480dac34166c627b71bb2972de558c644339 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 16f4ce89eda53645a412b73e0c5ea63e638e7268) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Fix documentation warnings in Qt NetworkTopi Reinio2020-11-193-6/+13
| | | | | | | Change-Id: I3653977a4511aa5c296a3954399342d98ac71586 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 49e8d0f3d5836e0fc1577ace1f0a3677d0e309b7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSocks5SocketEngine: Fix out-of-bounds access of QBAMårten Nordheim2020-11-191-3/+1
| | | | | | | | | | This should've been caught a long time ago, but long story short: it wasn't. This has been deprecated since 5.14 and is now asserting. Change-Id: Iddee22b1a68e5d1a03006831f795db8ec1c472be Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 456699da93323ca3ad56ca8f16aa3197dec380e6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* HTTP2: fix crash from assertionMårten Nordheim2020-11-192-2/+7
| | | | | | | | | | | | | | | | In general the protocolHandler isn't deleted unless the channel is being destructed. So instead of reset()ing the pointer we keep it around. Also update the http2protocolhandler to mimic the http1 handler a little closer: shutting down the channel in receiveReply if there's no reply/activeStreams, and not calling receiveReply at all if there's no activeStreams. Change-Id: I702547f594deb6b0c1384068f7e93e560527e8e2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 0b21c15b11e9af64741e26822f33dfba5975d9b0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Add the QtAndroidBearer.jar to the jar dependenciesAndy Shaw2020-11-121-1/+1
| | | | | | | | | This amends 8f088c9f82f7db089f62add74e1fe2ac8da55cd3 to ensure that both the QtAndroidNetwork.jar and QtAndroidBearer.jar are included as dependencies for the network module on Android. Change-Id: If5b53ee5efeafe17abc854a6c266c3aeab1dd649 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QAsn1Element: Read value in blocks to avoid oom at wrong lengthRobert Loehning2020-11-111-5/+13
| | | | | | | | | Fixes oss-fuzz issue 22272. Change-Id: I8a49b9487f632469402c983e517e817e8e65bef7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit ad9ca01853e90bdbe45f7ac2e8edd75cd0862801) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNAM: Work around QObject finicky orphan cleanup detailsMårten Nordheim2020-11-061-1/+11
| | | | | | | | | | Details described in a comment. Task-number: QTBUG-88063 Change-Id: I763ecfedf518de97615e04a8eaae0fe1fd784f52 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 1c6d6cbb62c5e93cbcad2d740c3b0ed01095618c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Pass SameSite through QNetworkCookieAllan Sandfeld Jensen2020-10-282-1/+9
| | | | | | | | | | It is an important new details in cookies, as a minimum pass it through, before we add API for it. Change-Id: I5222a24e0f50f3822a94cce126b5055fed1a8008 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 5dc1780369927b41b424277330d0e2ec7431252b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLocalSocket/Win: prevent writing to broken pipeAlex Trotsenko2020-10-151-0/+6
| | | | | | | | | | | | | When a peer closes the connection, the device remains opened for reading purposes. However, we should disable writing on disconnected socket. Otherwise, if the user issues a write() call, a new pipe writer object will be created and the write call occurs with invalid handle value. Change-Id: Id136798c7663df1fce7ed0aa4e3c6f5c65218a11 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 53b4556332e95820622742e9be16281a77f9d337) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* wasm: fix network status code propagationLorn Potter2020-09-252-6/+14
| | | | | | | | | Fixes: QTBUG-86620 Change-Id: I911636739dc57e47bc2a07a583f4e67fc08b1b19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit 49517aad70675433df6519b2071d11e5ebaa209a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Make network snippets a subdirs/lib projectPaul Wicking2020-09-242-8/+12
| | | | | | | | | Task-number: QTBUG-86497 Change-Id: I45eb22344beb777dd4ad20ba669b28e50cbfc3ec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 8333ff641457f5c18bfbc6f9b4ec523ae8526b61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip IPv6 address if DAD failedTimur Pocheptsov2020-09-181-0/+3
| | | | | | | | | | | Fixes: QTBUG-84256 Fixes: QTBUG-84253 Task-number: QTBUG-84254 Change-Id: I6116c8a337cc85adbca1bbab2609d6627127fa46 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 8be31ab2e15a20de586bd31f7786b5c3f34b7e4b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNetworkRequest: mark FollowRedirectsAttribute as deprecatedMårten Nordheim2020-09-151-1/+1
| | | | | | | | | | | We want to remove it in 6.0 when we make its behavior the new default and there is already an established alternative in 5.15. Deprecating this value will hopefully nudge people toward using it and making their code easier to transition to Qt 6. Task-number: QTBUG-85901 Change-Id: I6504df15b38a9a2530510eef7674cf9b1de88a14 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Schannel: Properly handle request for certificateMårten Nordheim2020-09-141-43/+58
| | | | | | | | | | | | | | | Certain servers, like smtp.live.com, will send a request for a certificate even though they don't require one. In Schannel this manifests as a warning/info status (SEC_I_INCOMPLETE_CREDENTIALS). In the cases where it's not needed we should suppress the warning and try to connect anyway, which is done by calling InitializeSecurityContext again when we get the status. Change-Id: I3c48140f2949d8557251a49a2b66946da9395736 Reviewed-by: Joshua GPBeta <studiocghibli@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 2253d5eca6de707080af9af11bc0dcfdea846fc5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator: move debug printing to a logging categoryMårten Nordheim2020-09-141-1/+5
| | | | | | | | | | The GSSAPI thing is a bit noisy and not useful unless you're debugging it specifically. Change-Id: I4a8c14159ec889776d06e0970ddf66083d788b63 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit dd5e4f54c8341f38b452bb0cc6d8ecfcf4f4cadc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNAM: HTTP/2: Set user-agent for the HTTP proxy's headerMårten Nordheim2020-09-141-4/+13
| | | | | | | | | The user-agent should be propagated to the proxy as well or else we get our default one. Change-Id: Id2283a8f2ade1a32f7fcf3d691be8d380d334b50 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 7e55642c87b71fdc41f30a1770efc45597e85837)
* QSsl: workaround a 'very secure' OpenSSL version (CentOS 8.x et al)Timur Pocheptsov2020-09-143-1/+18
| | | | | | | | | | | | | | CentOS it seems not only backported some OpenSSL 3 functions, but also raised the default security level to 2, making some of our keys (and MDs?) 'too weak' and failing auto-tests here and there as a result. For our auto-test we lower the level to 1, as it is expected to be. Fixes: QTBUG-86336 Change-Id: I7062a1b292e8b60eb9c2b2e82bd002f09f9da603 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 605d2163f1dcd7e1ad701ade913cb476b91865b1) Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* http: When falling back to http/1 use the socket's ssl configMårten Nordheim2020-09-141-10/+4
| | | | | | | | | | And not the ssl configuration we have on the reply since it's missing e.g. the newly received session ticket. Change-Id: Idfeb09012a847605a76d1fe4fb881c663d019b4a Reviewed-by: Peter Hartmann <peter@edelhirsch.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 62d85389a4a3ef22db80e721bf7c646a50874452)
* HTTP/2: Don't handle Remote Disconnected if we haven't switched yetMårten Nordheim2020-09-141-1/+2
| | | | | | | | | | In that case we haven't created the h2 handler yet, so it will crash when trying to access various members. Task-number: QTBUG-85902 Change-Id: Id0699ff06ef67748a16622703f731db0b0867771 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 27b1d1a1b24c37786c2cd1f9bdbe5917d97a4772)
* QAuthenticator: Don't reset phase on every set* callMårten Nordheim2020-09-131-11/+30
| | | | | | | | | | | | | | | In QAuthenticator "detach()" does not do what you expect. First off it doesn't detach at all, and secondly it will reset the phase that the authentication is in. This last part is intended, but it has one issue: if setUser/setPassword is called with the same arguments every time we ask for credentials then we never reach a fail-state since it thinks we will have a new chance to authenticate. Change-Id: I02e2e42242220f3fced3572323e6492429cf173e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 1cf84e7fd21a98a75b851b03467acf43c27d4504) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator: condition using GSSAPI on credentials availabilityMårten Nordheim2020-09-124-14/+68
| | | | | | | | | | | | AFAICT with GSSAPI the normal workflow is to run kinit or similar and authenticate before running programs relying on it. Therefore we can try to get the credentials before we choose whether or not to use Negotiate. Task-number: QTBUG-85123 Change-Id: If0478fdd45389b2939ad87c2f582776fe56959bb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit e0918af700acefd6e80562c051e42d0b64097e1f)
* QAuthenticator: Don't assume we haven't tried the URL credentialsMårten Nordheim2020-09-121-3/+4
| | | | | | | | | | | | | | It's problematic if we have already used these credentials and it failed. Since then we emit authenticationRequired only for QNAM to intercept it and "helpfully" suggest we use the same credentials again. By moving on we can check the cache or ask the user about the necessary credentials. Change-Id: Idaac5ae71167462369b66194ab6b1f77113d636a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 7dd99cd4885479feb7e09c55ab118c5ffb5b8476) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator: Don't assume cached credentials are newMårten Nordheim2020-09-111-1/+2
| | | | | | | | | | | | | Although this is more of a QNAM thing. In some cases what we load from the cache might be credentials we have already tried (and failed with, thus leading us to emit the authenticationRequired signal). With this patch we will fall through more often and ask the user for credentials. Change-Id: If2a556883c3ea5b0b225f4df273d38353b552b54 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 9021d4bbf0795cae601fe2bd656e15ae63f97e61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator(Negotiate): Try provided credentialMårten Nordheim2020-09-101-4/+17
| | | | | | | | | | | Windows only so far, need a similar patch for *nix, or an alternate approach when there is no server set up. Task-number: QTBUG-85123 Change-Id: Iff7a6b1540a2f1984153a237eea07c7bb1970064 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 219ed70957cc93640a79e1f8098987256efbe212) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QAuthenticator: Don't use Negotiate if unsupportedMårten Nordheim2020-09-101-0/+2
| | | | | | | | | | If we compiled without support for it then we shouldn't consider it an option either. Change-Id: If6e0a6afa738f375e360bf3d439196b39e47bee8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit b41a7afb000bfd86eb98f1e9e1b2711d6c4fb104) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNAM: Don't error out if the server doesn't support any ALPN we requestMårten Nordheim2020-09-101-2/+2
| | | | | | | | | | | If we ask for HTTP/2 or 1.1 and the server doesn't list either then we should still try to connect using HTTP/1(.1) just in case, to keep compatibility. Task-number: QTBUG-85902 Change-Id: I6ff2e38ac9d767e482a19ee4c81d101be37d3fab Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 09e22c6c3280d4187b1ed2d979ceea478b7bed75)