summaryrefslogtreecommitdiffstats
path: root/src/network/access
Commit message (Collapse)AuthorAgeFilesLines
* QAuthenticator: condition using GSSAPI on credentials availabilityMårten Nordheim2020-09-111-1/+8
| | | | | | | | | | | | 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. Pick-to: 5.15 Task-number: QTBUG-85123 Change-Id: If0478fdd45389b2939ad87c2f582776fe56959bb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QAuthenticator: Don't assume we haven't tried the URL credentialsMårten Nordheim2020-09-111-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. Pick-to: 5.15 Change-Id: Idaac5ae71167462369b66194ab6b1f77113d636a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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. Pick-to: 5.15 Change-Id: If2a556883c3ea5b0b225f4df273d38353b552b54 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: Enable HTTP/2 by defaultMårten Nordheim2020-09-104-14/+16
| | | | | | | | | | | | | | | It has been in Qt for some years now and 6.0 marks a good point to enable it by default. The exception is connectToHostEncrypted where we still require the users to enable it explicitly since there's no logical way to disable it. [ChangeLog][QtNetwork][QNetworkAccessManager] HTTP/2 is now enabled by default. Fixes: QTBUG-85902 Change-Id: Ia029a045727cc593d77df9eb3a5888522ad19199 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: fix stall due to edge case when connected with no request queuedMårten Nordheim2020-09-101-2/+12
| | | | | | | | | | | | It really could only manifest itself if you started a request and then immediately cancelled it and then started another one to the same site. But only if in a certain race outcome - the connection that the backend was establishing had to finish connecting after aborting but before a new request had been queued! Change-Id: I7cad2cf4ac1f64cc838498cefa076cd2c6d26701 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Huffman compression: handle QByteArray's elements as unsigned charTimur Pocheptsov2020-09-071-2/+4
| | | | | | | Fixes: QTBUG-86418 Pick-to: 5.15 Change-Id: Ie57ecad2b1fda7c2fc0de60cbdb4304c00e645d0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: enable httpmultipartLorn Potter2020-09-049-6/+32
| | | | | | | This allows for multipart requests. Change-Id: I1206d160cfd9150a9627c36ed60ea4cbb58e95aa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qnetworkaccessbackend_p.h: Add missing "We mean it comment"Friedemann Kleint2020-09-021-0/+11
| | | | | Change-Id: I079ad30c0b96dc3a1c7a89459ad0e1488999bc56 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Fix documentation warnings in Qt NetworkTopi Reinio2020-08-311-3/+9
| | | | | | Pick-to: 5.15 Change-Id: I3653977a4511aa5c296a3954399342d98ac71586 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix warningMaurice Kalinowski2020-08-281-2/+2
| | | | | | | Missing override Change-Id: Ic714110686338c4cfdbe583dba22c5a2f7c8ce1c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Redo QNetworkAccessBackend and various cleanups around itMårten Nordheim2020-08-2714-457/+791
| | | | | | | | | | | | | | | | | | | | | | Makes the QNetworkAccessBackendFactory a real interface to be used in plugins. Requires exporting some classes but they're not made public yet. Removes unused features and functions. Some things are likely still unused due to being specific for HTTP but the HTTP network replies don't use this backend system. Changes QNetworkAccessBackend to use a more traditional read(char*, qint64) function for the "downloaded" data. And an optional readPointer if supported. So far no backends have it so it's somewhat useless, but it may be useful going forward. If not it shall be deleted Converts all current backends to the new setup Easy enough, also gets rid of some unused functions. Task-number: QTBUG-80340 Change-Id: I9339e6c6eb394c471c921f5cafd3af6175936399 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove QFtp sources etc. in favor of alternate distributionMårten Nordheim2020-08-278-3220/+0
| | | | | | | | | | | | While we initially wanted to just disable the functionality the way it is currently built forces people to do a full build of Qt just to enable it. Instead of doing this half-measure let's just remove the code completely from QtBase and rather prepare QtNetwork to handle being a plugin that can be compiled at any time. Task-number: QTBUG-80340 Change-Id: I19155c8c167cf932088f01b2a9706d0e7ab792d1 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Make QNetworkAccessManager::supportedSchemes virtualMårten Nordheim2020-08-242-9/+7
| | | | | Change-Id: I6807e2133049551bbaa4c6f312b6a00ea752f81b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* http: When falling back to http/1 use the socket's ssl configMårten Nordheim2020-08-241-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>
* QNetworkReply(http): Ignore ssl errors in all reserved channelsMårten Nordheim2020-08-241-2/+6
| | | | | | | | | | | and not just the active one(s). When starting the connection with HTTP/2 and calling QNetworkReply::ignoreSslErrors() it would previously only ignore the errors in the single active channel that was used, but if we then fall back to HTTP/1.1 then we'll use the 5 other channels as well, and those would then fail due to the ignored ssl errors. Change-Id: I7aeb5b59897dd3a53579f0d38bd255bc2d97c2bb Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QDecompressHelper: Fix warnings in zstd codeMårten Nordheim2020-08-171-4/+1
| | | | | | | | | | | | | One warning about unused variable (dataLeftover), which was at some point replaced by the class variable 'decoderHasData'. The second warning was a fault of logic: checking that the unsigned value retValue was greater than or equal to zero. Which only came about because they initially did different things but the branches got merged and the logic became flawed. Change-Id: Ia3a04516c1b7b5f962226998bf3f4d101dd38148 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QDecompressHelper: Introduce zstd supportMårten Nordheim2020-08-143-2/+86
| | | | | | | | | Also take this opportunity to reshuffle the content-encodings in the intended ordering since the ordering is used to signify priority. Task-number: QTBUG-83269 Change-Id: I022eecf1ba03b54dbd9c98a9d63d05fb05fd2124 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Set default redirect policy to NoLessSafeRedirectPolicyFrederik Gladhorn2020-08-136-39/+22
| | | | | | | | | | | | | | | | | | | | | Not following redirects is not a feature, but just a hastle for everyone. The main issue with switching this default is that applications that actually do manual redirect handling will break in various ways. FollowRedirectsAttribute was removed as it no longer serves any purpose beyond duplicating the default value. [ChangeLog][Network] QNetworkAccessManager now follows redirects by default with the NoLessSafeRedirectPolicy. [ChangeLog][Potentially Source-Incompatible Changes] QNetworkRequest::FollowRedirectsAttribute was removed and has been superseded by QNetworkRequest::RedirectsPolicyAttribute Fixes: QTBUG-85901 Change-Id: Ic5b776180a4b84ac4fc895158bb5a66a3c91a042 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: Don't error out if the server doesn't support any ALPN we requestMårten Nordheim2020-08-131-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>
* QNAM: Don't close the connection due to not having a layer preferenceMårten Nordheim2020-08-131-2/+5
| | | | | | | | This seems to only be happening when we have a single channel because otherwise it will try IPv4 in one channel and IPv6 in the second. Change-Id: I0d513e25fefffeabfc733e895827aa12da335ef9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: HTTP/2: Set user-agent for the HTTP proxy's headerMårten Nordheim2020-08-131-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>
* QNAM: Fix proxy auth handling when requesting but not yet changed to h2Mårten Nordheim2020-08-132-2/+4
| | | | | | | | In some cases (i.e. with SOCKS) we don't have a HTTP/2 request ready yet so it would just error out. Change-Id: I6449de5fb52f5208d5641062c5906c3baff18b77 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* HTTP/2: Don't handle Remote Disconnected if we haven't switched yetMårten Nordheim2020-08-121-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>
* QDecompressHelper: Change order of encodingsUlf Hermann2020-08-121-1/+1
| | | | | | | | | Before the introduction of QDecompressHelper gzip was preferred over deflate. The change seems to be accidental. Amends commit 7b76379a89158f10780cbfc74965027246faec68. Change-Id: I70f33d551912465d63f49ea3db1ac3575d19a92d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDecompressHelper: Add brotli supportMårten Nordheim2020-08-063-0/+125
| | | | | | Task-number: QTBUG-83269 Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make use of QDecompressHelper for HTTP downloadsMårten Nordheim2020-08-056-139/+63
| | | | | | | | | | Changes are not too big for now. Just replaces use of the previous calls to the zlib decompression function. And initialize QDecompressHelper when we know the content-encoding. Task-number: QTBUG-83269 Change-Id: I41358feaef2e7ac5f48f14e3f95ec094e0c110b7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Privately introducing QDecompressHelper for network purposesMårten Nordheim2020-08-053-0/+599
| | | | | | | | | To support streaming decompression in QNAM. Will also be used to refactor existing decompression code in QNAM. Task-number: QTBUG-83269 Change-Id: Iecf3e359734163f15686c949f75d41fa4794a00e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Another round of 0->nullptr cleanupAllan Sandfeld Jensen2020-07-312-3/+3
| | | | | Change-Id: Ic8db7dc252f8fea46eb5a4f334726d6c7f4645a6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* wasm: fix setTransferTimeoutLorn Potter2020-07-294-6/+8
| | | | | | | | | | WebAssembly does not need the http feature, but these functions were hidden behind that feature. Fixes: QTBUG-83867 Pick-to: 5.15 Change-Id: I7cd9aa73003f45ccbc2613c67c21e4067d6edddd Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix network headers logicLorn Potter2020-07-291-6/+8
| | | | | | | Fixes: QTBUG-85083 Pick-to: 5.15 Change-Id: Iaf0f3365ee20fe257f3edac0e1105bdfcc5ba0da Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOSTor Arne Vestbø2020-07-081-1/+1
| | | | | Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-072-2/+2
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove unnecessary ; after function implementationsLars Schmertmann2020-07-062-2/+2
| | | | | | Task-number: QTBUG-82978 Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Only use one macro per lineLars Schmertmann2020-07-034-5/+10
| | | | | | | | | Also add a ; where it is missing. Task-number: QTBUG-82978 Change-Id: Ic5d2a07363c25ab641d234baca89bc62238458cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make feature datetimeparser depend on feature datestringEdward Welbourne2020-07-022-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | No client of QDateTimeParser actually uses it unless datestring was enabled, nor is it any use without datestring. Various methods conditioned on datestring are broken unless datetimeparser is enabled. We can't condition public API on datetimeparser, as it's a private feature, but client code can condition use of it on the private feature. All string-to-date/time conversions that use a string format (this includes all locale-specific formats) depend on feature datetimeparser. Change #if-ery (or add it) in all client (including test) code to test the right feature. Tidied up some code in the process. Killed some already-redundant textdate #if-ery. Renamed a test whose name claimed it involved locale, which it doesn't, in the course of #if-ing it. This simplifies the condition for feature datetimeedit (which overtly depended on textdate, redundantly since it depends on datestring which depends on textdate; its dependence on datetimeparser now makes its dependency on datestring also redundant). It also removes the need for assorted datestring checks in QDateTimeParser itself. Change-Id: I5dfe3a977042134b2cfb16cbcc795070634e7adf Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: do not close QIODevice on errorLorn Potter2020-06-291-3/+0
| | | | | | | | | | | Closing it early means the user may get this message when reading data without checking for error: 'QIODevice::read (QNetworkReplyWasmImpl): device not open' Change-Id: I377fc3da68e9d9f14f8504ace5addbb4f8e3c539 Fixes: QTBUG-85176 Pick-to: 5.15 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use QList instead of QVector in networkJarek Kobus2020-06-267-27/+23
| | | | | | Task-number: QTBUG-84469 Change-Id: I7827da68e73ca8ff1e599c836f2157894c452b63 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move implementation of QVector/List back to qlist.hLars Knoll2020-06-201-2/+1
| | | | | | | | | | | | | And name the main class QList. That's also the one we document. This gives less porting pain for our users, and a lot less churn in our API, as we use QList in Qt 5 in 95% of our API. In addition, it gives more consistent naming with QStringList and QByteArrayList and disambiguates QList vs QVector(2|3|4)D. Fixes: QTBUG-84468 Change-Id: I3cba9d1d3179969d8bf9320b31be2230d021d1a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: fix crash when getting error like 404Lorn Potter2020-06-201-1/+0
| | | | | | Pick-to: 5.15 Change-Id: Ia9b81aaa8b1e9ea6ab20b8c6ff6f197e95d46d7d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: fix network reply timeout and error handlingLorn Potter2020-06-191-12/+21
| | | | | | | | Fixes: QTBUG-83728 Change-Id: Ib8184a497a028949eea20e9d189d79da51ccc290 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> (cherry picked from commit b2e998d4678b82f823d24f3c97d78dec034f4e71) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QNAM: Fix my silly leftover mistakeMårten Nordheim2020-06-181-1/+0
| | | | | | | | | | | I removed the line locally, and then added it back for testing and forgot to remove it again. Amends a0bfa4e1f8e223927cbb285bb17d1a00a5c2d4b6. Task-number: QTBUG-84907 Change-Id: I7d6d0237742f4c3fc3ca0a2532d776325f396aab Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: Remove network connectivity pre-checkMårten Nordheim2020-06-155-76/+0
| | | | | | | | | | | | | | | | | | | The connectivity pre-check has been around for a long time, and it has caused various issues in that time. Certain scenarios, like using certain VPN configurations, might confuse the OS into thinking you don't have and network connectivity at all and abort the connection. Especially noticeable/frustrating when the connection was going to a host inside the local network. The negative impact of this change would at worst be that we might try to connect and it will wait some amount of time before the OS tells us the connection failed in situations where it would previously have been aborted before it started. But the false-negatives are not really an OK sacrifice in that case. Fixes: QTBUG-84907 Change-Id: I37fc69051e39df3c1a1fecb56ef54521a4d3d0c3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Http: Fix POST-to-GET redirects still uploading or transmitting CLMårten Nordheim2020-06-125-0/+38
| | | | | | | | | | | | | | CL = Content-Length The uploadByteDevice was kept after a redirect which caused the internals to assume that we had to upload the data. Even if this was not the case we still transmitted the Content-Length header from the first request which was now stored in two places. Fixes: QTBUG-84162 Pick-to: 5.15 Change-Id: Ic86b1ef0766ffcc50beeed96c1c915b721d40209 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNAM: docs cleanup from NetworkAccessibleMårten Nordheim2020-06-121-47/+0
| | | | | | | It was removed but some documentation bits were still there, apologies Change-Id: I1888b34fe04e6566349d35a27391d0bd14d622d4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* wasm: fix network POST data corruptionLorn Potter2020-06-112-5/+5
| | | | | | | | | | Emscripten does not like when the post data gets deleted in the local scope. Fixes: QTBUG-84685 Pick-to: 5.15 Change-Id: I17f9d5cc3253c26b42253daa68e2fbaccc48eaf6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Port QtNetwork from QStringRef to QStringViewLars Knoll2020-06-104-16/+16
| | | | | | | | 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>
* Remove winrtOliver Wolff2020-06-061-8/+0
| | | | | | | | | 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-043-14/+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>