summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Preventing caching of null authenticatorEric Lemanissier2014-09-091-0/+2
| | | | | | | | | | | In some cases, e.g. when bad credentials are provided in an ftp URI, QNetworkAccessAuthenticationManager::cacheCredentials is called with a null authenticator. This authenticator should not be cached, because it is useless, and leads to inconsistencies in the use of the cache Task-number: QTBUG-40622 Change-Id: If2a0a422b915f268648f5eef1d68601446123371 Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* Add missing private headers warningSamuel Gaist2014-09-043-0/+33
| | | | | Change-Id: I7a4dd22ea3bcebf4c3ec3ad731628fd8f3c247e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Network: Fix NTLM (SSPI) with HTTP and HTTPS proxiesMarkus Goetz2014-08-232-7/+7
| | | | | | | | | | | | | | | | | | | | | This commit should fix proxy authentication when NTLM is used. NTLM differs from normal HTTP(S) authentication by having 2 roundtrips instead of 1, some parts of our code however were not prepared for that. I've tested this patch with Microsoft Forefront, both with normal NTLM and with NTLM SSPI (in Windows domain). I removed an optimization added in 3c3ea9a8, I could not see that behavior anymore. That commit was the wrong fix in my opinion. [ChangeLog][QtNetwork] Fix NTLM (SSPI) Proxy Authentication (HTTP/HTTPS) Task-number: QTBUG-30829 Task-number: QTBUG-35101 Change-Id: Idcc9c0dbf388b011d49f2806e9a6dd55ebc35cec Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* refactor disconnectFromFtp to remove cached entries when necessaryMatt Broadstone2014-08-152-12/+15
| | | | | | | | | | | | | | | | In cases where a cached ftp connection fails to connect, or a file transfer has failed, we should removed the cached connection. Since qnam has an idea of a single internal QFtp per full operation, when file transfers failed previously the cached connection would be reused for subsequent connections and thus fail. [ChangeLog][QtNetwork][QNetworkAccessManager] QNetworkAccessManager now properly handles FTP transfer failures by removing failed cached ftp connections. Task-number: QTBUG-40797 Change-Id: Ie090a39ceddd7e58a0d8baf7d01f2a08c70162e5 Reviewed-by: Richard J. Moore <rich@kde.org>
* Doc: document that we have unfixed bugs with waitForXxx on WindowsThiago Macieira2014-08-111-0/+23
| | | | | | | | | | | We have to document because we don't know how to fix the bug and don't know when they will be fixed. We should also disable the unit tests related to those functions, as they probably cause CI instability. Task-number: QTBUG-24451 Change-Id: I0e60682ec4af7570258b13735339051ba8f4a6e4 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix compilation if EC is disabled in OpenSSLJoni Poikelin2014-07-293-0/+8
| | | | | | | | | Some Linux distributions disable EC by default which causes compile errors on those platforms. Task-number: QTBUG-40394 Change-Id: If5816d473bd1d64b1d4977860db662704a83310f Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix buffer overrun error with some proxy serversArtem Shevchenko2014-07-281-3/+0
| | | | | | | | | | | In some cases, depending on the proxy server response, the current implementation of QHttpSocketEngine may write to memory beyond the allocated buffer size. That will trigger undefined behavior on UNIX systems and a buffer overrun exception if compiled with visual studio. Change-Id: I5769d10c56b6a7483d6d94672aa4321287b82651 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QNAM: Fix CPU load for limited upload QIODeviceMarkus Goetz2014-07-252-0/+23
| | | | | | | | | | | | | | | This fixes high CPU load for upload devices that don't generate a constant stream of data. Their readData() function was called all the time without returning actual data. This was noticed when implementing an upload device that emits data in a limited way for bandwidth limiting. [ChangeLog][QtNetwork][QNetworkAccessManager] Fixed high CPU load when handling POST/upload QIODevice that generates data on readyRead(). Change-Id: Iefbcb1a21d8aedef1eb11761232dd16a049018dc Reviewed-by: Richard J. Moore <rich@kde.org>
* Added stream version into network cache file formatNikita Krupenko2014-07-171-1/+9
| | | | | | | | | | | | | | | | | | | At the moment, there is no stream information in the cache file. This can lead to a problem when current stream version differs from version cache file written with. As an example, if file written with Qt 5.1.1, QTimeDate in the metadata stored as 13-bytes value, but Qt 5.2 and later can read additional 4 bytes which breaks following data, leading to network request just hangs forever. Adding stream version fixes this problem. As cache format changed, cache version bumped. Task-number: QTBUG-36219 Change-Id: I467d8c9fda82bcf9302192f51e7a00d2f6a9ff66 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Android: Update QSslSocketPrivate::fetchSslCertificateData()Christian Strømme2014-07-141-110/+16
| | | | | | | | | | | | Replaces the raw jni calls with our own jni wrappers. This allows us to make use of the centralized cache, avoid global data storage and use a more optimized way to attach to the jni environment. This change also removes the JNI_OnLoad() function since it's not used. If we need to add a JNI_OnLoad() function later, we should find a more suited place for it. Change-Id: Id84ead10c27d03d19c160304b1f9853b381a103c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QSslCertificate: blacklist NIC certificates from IndiaPeter Hartmann2014-07-091-0/+3
| | | | | | | | | | | Those intermediate certificates were used to issue "unauthorized" certificates according to http://googleonlinesecurity.blogspot.de/2014/07/maintaining-digital-certificate-security.html , and are by default trusted on Windows, so to be safe we blacklist them here. Change-Id: I9891c5bee2dd82c22eb0f45e9b04abd25efeb596 Reviewed-by: Richard J. Moore <rich@kde.org>
* winrt: DNS lookup: don't have duplicate entriesOliver Wolff2014-07-011-1/+6
| | | | | Change-Id: I60ee29bd692f8e385080d4532a0e3230942a2cd3 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Android: Fix namespace usageChristian Strømme2014-06-301-0/+4
| | | | | | | This change makes it possible to set a Qt namespace for Android builds. Change-Id: I79f4ae8200223f36f97e2849aae49e45b8850d23 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix compilation on Windows without precompiled headersThiago Macieira2014-06-251-0/+1
| | | | | | | | | | | qnetworkinterface_win_p.h needs to include at least one Qt header before it can use QT_BEGIN_NAMESPACE. That header is the first header in qnetworkinterface_win.cpp. Found when trying to compile Qt with ICC. Change-Id: Iaa312ff54243b6fb3beb107f0eda74f92c6e3ebb Reviewed-by: Richard J. Moore <rich@kde.org>
* Merge remote-tracking branch 'origin/stable' into 5.3Frederik Gladhorn2014-06-251-0/+2
|\ | | | | | | Change-Id: I7462840d15583ead82e86fcf5c84659b909e8c4e
| * QDnsLookup: Fix build with uClibcFatih Aşıcı2014-06-201-0/+2
| | | | | | | | | | | | | | | | | | | | uClibc doesn't have a nsmap member in __res_state. Since it also doesn't have res_nquery() which is mandatory for QDnsLookup, we can simply disable the code to fix the build. Change-Id: Ia872f535519aca3a2de763548c6dd0e3e0ee20d4 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Mandeep Sandhu <mandeepsandhu.chd@gmail.com>
* | network internals: do not try to cache a deleted entryPeter Hartmann2014-06-242-0/+13
| | | | | | | | | | | | | | | | | | We were keeping a dangling pointer to a non-existent QIODevice around which would lead to a crash. Task-number: QTBUG-17400 Change-Id: Ie374cbb94bb45c9b0fbef46287b3317f60154123 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Mac networking: only try system proxy credentials oncePeter Hartmann2014-06-231-4/+9
| | | | | | | | | | | | | | | | ... instead of running into an endless loop in case they are wrong. Task-number: QTBUG-30434 Change-Id: Iab258ebe1098a0c95f19da789a7a86de9d5bf149 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Mac networking: check system keychain for proxy authPeter Hartmann2014-06-234-22/+24
| | | | | | | | | | | | | | | | | | | | ... and not when normal HTTP authentication is required. Also, query the system keychain for the right credentials depending on the URL scheme. Task-number: QTBUG-30434 Change-Id: Ib6f74029b2e0de9734497440e3b0e48cdf73adcb Reviewed-by: Richard J. Moore <rich@kde.org>
* | Fix warnings from MSVC 2013Thiago Macieira2014-06-211-2/+2
| | | | | | | | | | | | | | qhosaddress.h(88) : warning C4224: nonstandard extension used : formal parameter 'sockaddr' was previously defined as a type Change-Id: I38ee9dcb0d81d5ec4f71c2b50dc4f331eb61e7de Reviewed-by: Richard J. Moore <rich@kde.org>
* | QProcess: Handle spurious socket notifications for stdout and stderrThiago Macieira2014-06-121-1/+11
|/ | | | | | | | | | | | | | | | | | | | | | On Unix systems where the GUI event dispatcher uses a notification system for socket notifiers that is out of band compared to select(), it's possible for the QSocketNotifier to activate after the pipe has been read from. When that happened, the ioctl(2) call with FIONREAD might return 0 bytes available, which we interpreted to mean EOF. Instead of doing that, always try to read at least one byte and examine the returned byte count from read(2). If it returns 0, that's a real EOF; if it returns -1 EWOULDBLOCK, we simply ignore the situation. That's the case on OS X: the Cocoa event dispatcher uses CFSocket to get notifications and those use kevent (and, apparently, an auxiliary thread) instead of an in-thread select() or poll(). That means the event loop would activate the QSocketNotifier even though there is nothing to be read. Task-number: QTBUG-39488 Change-Id: I1a58b5b1db7a47034fb36a78a005ebff96290efb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Fix QT_NO_BEARERMANAGEMENT compile of QHttpThreadDelegate.Steffen Imhof2014-06-102-4/+4
| | | | | | | Re-order the constructor parameters for QHttpNetworkConnection to be consistent with the #ifndef version. Change-Id: Icd8be4406ff549d468e06d635fac2ddc34826b1c Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix QT_NO_LIBRARY compile in Unix DNS lookup implementation.Steffen Imhof2014-06-101-2/+2
| | | | | | | The static method QDnsLookupRunnable::query() got an additional parameter for QTBUG-30166, but the #ifdef'd part was not updated. Change-Id: Ifc317bfae6e02c00936e1922ec77f89fb5faf497 Reviewed-by: Richard J. Moore <rich@kde.org>
* NSURLConnection: Set http response status code.Morten Johan Sørvig2014-06-071-2/+11
| | | | | | | | Make XMLHttpRequest.status work. Task-number: QTBUG-38864 Change-Id: Ic691b39a43aeb2ad3cd2e8ffef64c74d02699755 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* winrt: set error if tcp socket initialization failsOliver Wolff2014-06-061-1/+4
| | | | | Change-Id: I31a2684ffdc864c69fe896829bca860e88c4a6ca Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* winrt: do not try to close non existent socketsOliver Wolff2014-06-061-2/+2
| | | | | Change-Id: I41103db89985f8fbde1faaccaf33c7a76c275f7d Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* remove HSTRING instancesMaurice Kalinowski2014-06-034-49/+49
| | | | | | | | | | | HSTRING needs to be released or handles will be leaked. Instead use HString which takes care of resource management on its own. Task-Number: QTBUG-38115 Change-Id: I2c767776c1f22f45acd8dd77b693f30d63d894b9 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Doc: be more explicit about need to set expected SSL cert in errorsArnaud Bienner2014-05-272-2/+4
| | | | | | | | Note added in QNetworkReply and QSslSocket documentation. Task-number: QTBUG-16770 Change-Id: I2dd8cfb913ec29a96b5465a905cd213713b8d537 Reviewed-by: Richard J. Moore <rich@kde.org>
* WinRT: Fix compile warningsMaurice Kalinowski2014-05-263-3/+7
| | | | | Change-Id: If223dd73b9558a0f5144be38f19a61316f8c807b Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* Ensure all encrypted bytes are sent when closing QSslSocket.Richard J. Moore2014-05-261-0/+2
| | | | | | | | | | If you do sock->write(data) followed by sock->close() then the data written is not transmitted unless you flush when using QSslSocket but is when using QTcpSocket. This change makes QSslSocket work like QTcpSocket. Change-Id: Ia2e1c021dc48ac0d573f78da782ea77641c03bc1 Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* IPv6 scope ID of zero is not validThiago Macieira2014-05-262-6/+9
| | | | | | | | IANA reserves scope ID of 0x0 to mean "no scope ID", so make sure that we don't try to set it when reading from the sockaddr_in6 structure. Change-Id: I71b207e6f8262ab2bf9fde993288a71ba63c7572 Reviewed-by: Richard J. Moore <rich@kde.org>
* Mark the missing QDnsLookup constructor as \internalAndy Shaw2014-05-211-0/+5
| | | | | | | | | Implementation will be added for Qt 5.4.0 as it cannot be done sooner. Change-Id: I4d2626416fae99339988cd994653ce7ec753f081 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid accessing the internals of the SSL_CIPHER struct.Richard J. Moore2014-05-193-3/+4
| | | | | | | | | | | Avoid accessing the internals of the SSL_CIPHER struct since this has changed size etc. over time leading to binary incompatibilities. Task-number: QTBUG-32423 Task-number: QTBUG-23363 Change-Id: I8cb399484e3a62be7d511f4b8b22c876825c87d4 Reviewed-by: Peter Hartmann <phartmann@blackberry.com> Reviewed-by: Daniel Molkentin <daniel@molkentin.de>
* Fix crash in QNetworkAccessManager.Jędrzej Nowacki2014-05-192-4/+12
| | | | | | | | | | Recreating QCoreApplication could cause a crash in QNetworkAccessManager constructor. That was caused by an invalid shutdown detection introduced in f273d6fbc02055ff3999adc0df76360ca0670435. Task-number: QTBUG-36897 Change-Id: Ib5bba773a2a4fcde690a3a93680aef551aae3a5b Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-141-1/+1
|\ | | | | | | Change-Id: If1abbe7810ea43ae750db91066f9f579c79b2289
| * Fix the documentation on how to use -openssl-linked.Richard J. Moore2014-05-131-1/+1
| | | | | | | | | | | | | | | | You set the environment /before/ you run configure. Change-Id: I6954656f892214f41b5f2ec4e3f4926eb5a9e247 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Fix MSVC warnings in qspdyprotocolhandlerKai Koehne2014-05-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | Fix warnings about 'truncation of constant value': qspdyprotocolhandler.cpp(583) : warning C4309: '=' : truncation of constant value qspdyprotocolhandler.cpp(656) : warning C4309: '=' : truncation of constant value qspdyprotocolhandler.cpp(659) : warning C4309: '=' : truncation of constant value Change-Id: I3c32b9f47c06da9b50f5c94871a2ee455b3a5cb6 Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-122-23/+24
|\| | | | | | | Change-Id: I9300572e2b74f0564b2589cbd0fbdf24850f68df
| * Ignore expired certificate during certificate validationDaniel Molkentin2014-05-112-23/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenSSL has a bug when validating a chain with two certificates. If a certificate exists twice (which is a valid use case for renewed CAs), and the first one it hits is expired (which depends on the order on data structure internal to OpenSSL), it will fail to validate the chain. This is only a bandaid fix, which trades improved chain validation for error reporting accuracy. However given that reissuing of CA certs is a real problem that is only getting worse, this fix is needed. See also: https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html#WARNINGS [ChangeLog][QtNetwork][QSslSocket] Added a workaround to an OpenSSL problem that may cause errors when the trust store contains two certificates of the issuing CA, one of which is expired. Task-number: QTBUG-38896 Change-Id: I8f17972ac94555648098624e470fff0eff2e7940 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* | Fix debug output when enabling QABSTRACTSOCKET_DEBUG.David Faure2014-05-061-1/+1
| | | | | | | | | | | | | | | | Some calls pass len=32, so garbage was shown when maxlen (readBytes) is smaller. Change-Id: I97e61dcdf5a0db032317c57afb4bfb406437d8d5 Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-011-1/+1
|\| | | | | | | | | | | This merge adds the opengl rename. Change-Id: I84ea0b6abee9780ebb2cf3f64ab9e3fdf2acab3e
| * QAbstractSocket: enable read notification for unbuffered socketsPeter Hartmann2014-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | This restores behavior for UDP sockets as it was in 5.2.1. Change 13c246ee119fdb10d91f509b968a221d4fc1d8ba introduced a behavioral change / regression in that respect. Task-number: QTBUG-37489 Change-Id: I8f0b26d763dd66ea6edcc343e91ff5c9c7bdc0f2 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Add missing QT_NO_NETWORKPROXY guards around HTTP connect statementsAndrew Knight2014-04-291-0/+6
| | | | | | | | | | | | | | | | | | Without these, a spew of connection warnings will occur when using HTTP on Qt builds with QT_NO_NETWORKPROXY. Change-Id: I330f6d98d1abdbadc57768dc48b8fab0ee1f6655 Reviewed-by: Oliver Wolff <oliver.wolff@digia.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* | Merge remote-tracking branch 'origin/release' into stableJani Heikkinen2014-04-232-122/+215
|\| | | | | | | Change-Id: Id13b4a3803664692f32f9d57549be8a0c4a08567
| * WinRT: Fix TCP socket readsAndrew Knight2014-04-222-122/+215
| | | | | | | | | | | | | | | | | | | | | | | | All read calls are now pulled from an intermediate buffer which is populated from the asynchronous callback (this was a TODO previously, and was breaking downloads of large requests). As a side-benefit, the use of only async callbacks ensures fewer first-chance exceptions appear in the debug output. Task-number: QTBUG-30196 Change-Id: I5653742d8d94934a4b4a4227298865d20518bc4c Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* | Fix build against older OpenSSL.Sérgio Martins2014-04-141-0/+2
|/ | | | | | | The declaration of q_SSL_ctrl is ifdefed, so ifdef it's usage too. Change-Id: I99a53af6f4f24ed991d39ab89f18e03b8f38c617 Reviewed-by: Richard J. Moore <rich@kde.org>
* Support for DH and ECDH key exchange for QSslSocket serversRichard J. Moore2014-04-093-0/+80
| | | | | | | | | | | | | | | | | Despite supporting DH and ECDH key exchange as a client, Qt did not provide any default parameters which prevented them being used as a server. A future change should allow the user to control the parameters used, but these defaults should be okay for most users. [ChangeLog][Important Behavior Changes] Support for DH and ECDH key exchange cipher suites when acting as an SSL server has been made possible. This change means the you can now implement servers that offer forward-secrecy using Qt. Task-number: QTBUG-20666 Change-Id: I469163900e4313da9d2d0c3e1e5e47ef46320b17 Reviewed-by: Daniel Molkentin <daniel@molkentin.de> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
* Ensure we initialize things before checking the openssl version.Richard J. Moore2014-04-081-0/+3
| | | | | | Task-number: QTBUG-37783 Change-Id: Ie276e597062d8bfc74ef57251ed21a94020e030f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QNetworkReplyHttpImpl: fix misuse of QDateTime::addSecs()David Faure2014-04-081-2/+1
| | | | | | | | | | QDateTime::addSecs() is a const function and returns a new QDateTime with the given seconds added, thus the current statement had no effect. Found by applying Q_REQUIRED_RESULT in dev branch. Change-Id: Id712334f91e0adb40bafc23470bf46479334c81a Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix QNetworkRequest::setRawHeader() for QT_NO_CAST_FROM_BYTEARRAYRichard J. Moore2014-04-081-1/+1
| | | | | | | Avoid the implicit conversion in the doc snippet. Change-Id: Iacec6dab371a22c16f537af471f6653d9c5ad43d Reviewed-by: Andy Shaw <andy.shaw@digia.com>