summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Android: rename Android's package name for Qt 6Assam Boudjelthia2020-10-037-10/+10
| | | | | | | | | | Rename Android package name org.qtproject.qt5.android to org.qtproject.qt.android to avoid inconsistency with Qt 6 name. Also, we include the major version number in the jar target. Task-number: QTBUG-86969 Change-Id: Ibb68947289be1079911b34ea157bf089cc52c47f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QSsl: Remove enum value gapsMårten Nordheim2020-09-291-2/+2
| | | | | | | | These value gaps were there for binary compatibility, but we don't need those in Qt 6. Change-Id: I72a40d601b61f90e14562578e88493b0d54ff398 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Docs: Update default redirect policy enumerationMårten Nordheim2020-09-291-3/+4
| | | | | Change-Id: Ia72151cc0fbcb325572e7b623ef9a4b3236d797f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QSslConfiguration::setAllowedNextProtocol - remove the old signatureTimur Pocheptsov2020-09-282-8/+0
| | | | | Change-Id: I0b4b18e6ea2b78917220e77865fd92eb7a684179 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix qdoc warnings: supportedCiphers is a member of QSslConfigurationVolker Hilsheimer2020-09-281-7/+7
| | | | | | | ... not of QSslSocket. Change-Id: I9db5debe6a0aaa6a780b0047ae3f551ec3770fb4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Replace Q_REQUIRED_RESULT with [[nodiscard]]Allan Sandfeld Jensen2020-09-252-9/+9
| | | | | | | It was already used many places directly making the code inconsistent. Change-Id: I3b14bc6c333640fb3ba33c71eba97e78c973e44b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* wasm: fix network status code propagationLorn Potter2020-09-252-6/+14
| | | | | | | | Fixes: QTBUG-86620 Pick-to: 5.15 Change-Id: I911636739dc57e47bc2a07a583f4e67fc08b1b19 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Make network snippets a subdirs/lib projectPaul Wicking2020-09-232-8/+12
| | | | | | | | Task-number: QTBUG-86497 Pick-to: 5.15 Change-Id: I45eb22344beb777dd4ad20ba669b28e50cbfc3ec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-232-112/+112
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QDecompressHelper: limit decompression ratioMårten Nordheim2020-09-227-0/+93
| | | | | | | | To avoid potential decompression bombs. This is implemented with just a simple check that the ratio doesn't pass some hardcoded preset. Change-Id: I17246f0f43e73280cdb35a8f03d65885f5678ad6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Regenerate projectsAlexandru Croitor2020-09-222-4/+10
| | | | | | | | | Clean up the state of the projects, before changing the internal CMake API function names. Task-number: QTBUG-86815 Change-Id: I90f1b21b8ae4439a4a293872c3bb728dab44a50d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Correct link errors qtbaseNico Vertriest2020-09-211-1/+1
| | | | | | Task-number: QTBUG-86295 Change-Id: I27f6bbdadffb08a8794520a14dfe0e2334979575 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QNAM: try to send headers and body togetherGiuseppe D'Angelo2020-09-182-12/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For HTTP connections, QNAM defaults to opening its TCP socket in unbuffered mode. This means that Qt will send the data written into the socket right to the kernel, queueing only if the kernel says it doesn't want more data for the moment being. QNAM itself then uses separate write() calls to write the HTTP headers and the body of the request (like POST or PUT). These 2+ writes result in headers and body being sent over different TCP segments -- even if, in principle, a POST with a few bytes of data (e.g. a HTML form, or a REST or SOAP request) could fit in the same segment as the request. Multiple writes like this interact extremely poorly with other TCP features, e.g. delayed ACKs, Nagle's algorithm and the like. In a typical scenario, the kernel will send a segment containing just the headers, wait for the ACK (which may be delayed), and only then send the body (it wasn't sent before because Nagle was blocking it). The reply at this point is immediate (because the server can process the request and starts replying), but the delayed ACK is typically 40-50ms, and documented up to 500ms (!). If one uses QNAM to access a service, this introduces unacceptable latency. These multiple writes to the OS should be avoided. The first thing that comes into mind is to use buffered sockets. Now, there are good reasons to keep the socket unbuffered, so we don't want to change that. But the deal breaker is that even buffered sockets won't help in general: for instance, on Windows, a buffered write will immediately detect that the socket is ready for write and flush the buffer right away (not 100% sure of why this is necessary; basically, after populating the QTcpSocket write buffer, Qt enables a write socket notifier on the socket -- notifier that fires synchronously and immediately, without even returning to the event loop, and that causes the write buffer flush). Linux of course offers the perfect solution: corking the socket via TCP_CORK, which tells the kernel not to send the data right away but to buffer it up to a timeout (or when the option gets disabled again, whichever comes first). It's explicitly designed to support the case of sending headers followed by something like a sendfile(2). Setting this socket option moves the problem to the kernel and we could happily keep issuing multiple writes. Ça va sans dire, no other OS supports that option or any other similar option. We have therefore to deal with this in userspace: don't write in the socket multiple times, but try and coalesce the write of the headers with the writing of the data. This patch implements that, by storing the headers and sending them together with the very first chunk of data. If the data is small enough, this sends the entire request in one TCP segment. Interestingly enough, QNAM has a call setting TCP_NODELAY currently commented out because Qt doesn't combine "HTTP requests" (whatever that means). The call comes all the way back from pre-public history (before 2011) (!). This patch doesn't touch it. Fixes: QTBUG-41907 Change-Id: Id555d14e0702c9f75c3134b18277692eb3659afe Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Add links to Qt 6 changes files from module indexPaul Wicking2020-09-181-0/+4
| | | | | | Task-number: QTBUG-84051 Change-Id: Iac25df135c9d73a990b41243e08cd38ea78296a4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Skip IPv6 address if DAD failedTimur Pocheptsov2020-09-171-0/+3
| | | | | | | | | | Fixes: QTBUG-84256 Fixes: QTBUG-84253 Task-number: QTBUG-84254 Pick-to: 5.15 Change-Id: I6116c8a337cc85adbca1bbab2609d6627127fa46 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: build add flags for building QtAndroid.jarAssam Boudjelthia2020-09-161-1/+1
| | | | | | | | | | | | | Adds -source, -target, -Xlint:unchecked, -bootclasspath flags. Setting default javac build source and target versions to 8. Allow setting custom values for javac build versions via -DQT_ANDROID_JAVAC_SOURCE, and -DQT_ANDROID_JAVAC_TARGET. Task-number: QTBUG-86282 Change-Id: I98f4f193ac96016dc722d178594d7fd401202f68 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Add porting guide documentsPaul Wicking2020-09-161-0/+46
| | | | | | | | Also add existing such docs to the new document group Task-number: QTBUG-84051 Change-Id: I76f033f0846e09943f249d2beeb1606869eef382 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* CMake: Regenerate configure.cmake filesAlexandru Croitor2020-09-151-1/+1
| | | | | | Change-Id: I844e82b4655cf1967b16a7785b4e1ef777e61c22 Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* 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. Pick-to: 5.15 Change-Id: I3c48140f2949d8557251a49a2b66946da9395736 Reviewed-by: Joshua GPBeta <studiocghibli@gmail.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make QStringList an alias to QList<QString>Lars Knoll2020-09-121-1/+0
| | | | | | | | | | | | | | | | | | Fix our API, so that QStringList and QList<QString> are the same thing. This required a bit of refactoring in QList and moving the indexOf(), lastIndexOf() and contains() method into QListSpecialMethods. In addition, we need to ensure that the QStringList(const QString&) constructor is still available for compatibility with Qt 5. Once those two are done, all methods in QStringList can be moved into QListSpecialMethods<QString>. Change-Id: Ib8afbf5b6d9df4d0d47051252233506f62335fa3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSsl: workaround a 'very secure' OpenSSL version (CentOS 8.x et al)Timur Pocheptsov2020-09-123-0/+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 Pick-to: 5.15 Change-Id: I7062a1b292e8b60eb9c2b2e82bd002f09f9da603 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QAuthenticatorPrivate::parseHttpResponse: mark "host" as unusedMårten Nordheim2020-09-111-0/+3
| | | | | | | ... in the case where it is unused Change-Id: Ia181b975f07a8d1eee078867b98168ec5c326612 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QAuthenticator: condition using GSSAPI on credentials availabilityMårten Nordheim2020-09-114-14/+65
| | | | | | | | | | | | 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: move debug printing to a logging categoryMårten Nordheim2020-09-111-1/+5
| | | | | | | | | The GSSAPI thing is a bit noisy and not useful unless you're debugging it specifically. Pick-to: 5.15 Change-Id: I4a8c14159ec889776d06e0970ddf66083d788b63 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QAuthenticator: Don't reset phase on every set* callMårten Nordheim2020-09-111-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. Pick-to: 5.15 Change-Id: I02e2e42242220f3fced3572323e6492429cf173e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> 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>
* 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. Pick-to: 5.15 Task-number: QTBUG-85123 Change-Id: Iff7a6b1540a2f1984153a237eea07c7bb1970064 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* 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. Pick-to: 5.15 Change-Id: If6e0a6afa738f375e360bf3d439196b39e47bee8 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>
* CMake: Re-generate configure.cmake filesJoerg Bornemann2020-09-101-2/+1
| | | | | Change-Id: I9c325db8031e14cf2a2cfb49e5080e3043a0811a Reviewed-by: Cristian Adam <cristian.adam@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>
* Fix a number of MSVC integer conversion warningsFriedemann Kleint2020-09-101-1/+1
| | | | | | | | Mostly related to qstrlen(). Change-Id: I69e2052c83766e4fc466ed398d0d0eac011a77ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* TLS utils - move runtime check to compile timeTimur Pocheptsov2020-09-091-2/+6
| | | | | | | | | | While it's possible to instantiate safe_delete using a nullptr, the check in if-statement is 99.9(9) % of time redundant and equal to if (true && object). Some compilers will issue a compilation error (if warnings are treated as errors for example). Change-Id: Ib593dc53deb6d2e4b77ea5c896610dc536c61b7c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNetworkInterface: disable Netlink-based Linux support on AndroidThiago Macieira2020-09-081-1/+1
| | | | | | | | | | | | | Android 11's SELinux rules block the RTM_GETLINK requests that qnetworkinterface_linux.cpp needs to make. So disable this completely and fall back on the older rimplementation. Bionic has some workarounds in their getifaddrs() implementation to make this work. Fixes: QTBUG-86394 Pick-to: 5.15 5.15.1 Change-Id: I87447a0ecdee4dc7b506fffd163180c2b1db7835 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Don't use deprecated function: QVariant::canConvert(int targetTypeId)Wang Wei2020-09-081-1/+1
| | | | | | | | | Remove compile warning for -Wdeprecated-declarations. Change-Id: I747c8a390f26cfc4626e40c4684034c394bbf3c9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
* 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-313-6/+13
| | | | | | Pick-to: 5.15 Change-Id: I3653977a4511aa5c296a3954399342d98ac71586 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QLocalSocket: Print value OperationError on debug outputMarcel Krems2020-08-291-0/+3
| | | | | | Pick-to: 5.15 Change-Id: Ib3e38e8c0a46b2070eca1e65f081b2d6d2774020 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix warningMaurice Kalinowski2020-08-281-2/+2
| | | | | | | Missing override Change-Id: Ic714110686338c4cfdbe583dba22c5a2f7c8ce1c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qnetconmon: Downgrade Warning to DebugMårten Nordheim2020-08-281-1/+1
| | | | | | | | | It triggers when connecting to localhost (or when using socks proxy) and is nothing you can act on most of the time, so change it to qCDebug. Change-Id: I669fbde4fa0ed194703ea6a4dab13790aa771852 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Redo QNetworkAccessBackend and various cleanups around itMårten Nordheim2020-08-2717-464/+796
| | | | | | | | | | | | | | | | | | | | | | 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-2717-4221/+2
| | | | | | | | | | | | 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>
* QAbstractSocket: Resolve remaining Qt6 TODOsMårten Nordheim2020-08-243-54/+5
| | | | | Change-Id: Id257f0721c1cd5fcbafa9297bae0251a2d68e366 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Make QNetworkAccessManager::supportedSchemes virtualMårten Nordheim2020-08-242-9/+7
| | | | | Change-Id: I6807e2133049551bbaa4c6f312b6a00ea752f81b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QHostInfo: address a Qt 6 todoMårten Nordheim2020-08-242-18/+16
| | | | | | | | Merged the two functions, required adding a friend declaration Change-Id: I86265da19e4b5f53d9e2dc54de3e252f0364225b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Disable cipherstring-setting test for schannelMårten Nordheim2020-08-241-0/+2
| | | | | | | And put a note about it in the documentation Change-Id: I29126e4a80f83c256190e03b8fe01f3c869fd46d 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>