summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Various minor fixes for qdoc warnings.Richard Moore2012-05-065-37/+38
| | | | | Change-Id: I54c5ab6e1bfb1816bb510be9e2bfa1e3362faa36 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Fix more qdoc warnings in qtnetwork.Richard Moore2012-05-066-8/+17
| | | | | Change-Id: Ibfac6236e9f68b41e34e67ef03cfd590582439be Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QNetworkProxyFactory: check all the proxy environment variablesAdrien Bustany2012-05-051-1/+17
| | | | | | | | | | | QNetworkProxyFactory used to check only for the http_proxy environment variable in systemProxyForQuery. This patch makes it look as well in https_proxy, ftp_proxy and all_proxy. http_proxy is still used as a fallback value. Change-Id: I7934af70d191cd17dbce3b3789260ae1a8332986 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Use reference count to close down idle network sessionShane Kearns2012-05-051-4/+4
| | | | | | | | | | | | | | | | | QNetworkAccessManager was using the AutoCloseConnection property of QNetworkSession to close it when idle. However this property is only implemented for polling engines and not event driven engines. Instead, release the network session reference. If another request comes in, it will be resurrected from the shared session weak reference. If not, then after 2 minutes when the connection caches are flushed the ref count will reach zero and cause the QNetworkSession to be destroyed (which closes it) Task-number: QTBUG-15812 Change-Id: I2963bdf13fb02e3ac269489ea463669142f3c5f3 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Remove not present networks from QNetworkInterface::allInterfacesShane Kearns2012-05-051-2/+1
| | | | | | | | | | | | | | Windows 7 accumulates networks over time with the status "not present". This is so it can remember whether a given network was a public, home or work network next time you use it. By default, these networks are not returned when enumerating network interfaces, but we specified a flag to request all networks. These networks are generally not useful so use the default behaviour of not reporting them. Task-number: QTBUG-18824 Change-Id: I4edc4cea83a0e97a88ac649b7d8af95a8a600b89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtNetwork]Thiago Macieira2012-05-043-10/+10
| | | | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I94cc301ea75cc689bcb6e2d417120cf14e36808d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Pass network session to http delegateShane Kearns2012-05-041-0/+3
| | | | | | | | This functionality was in Qt4, and apparently lost in the QNetworkAccessHttpBackend -> QNetworkReplyHttpImpl change Change-Id: Ia354cfd2c10808a6543173ec017d911f1696e7fb Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Rename QAbstractSocket::PauseOnNotify -> PauseOnSslErrorsShane Kearns2012-05-044-7/+7
| | | | | | | | | | | | | | | Although we created an enum for pause modes to make 5.x binary compatible with 5.0, the enum value is not well named. In 5.1, we propose to add PauseOnProxyAuthentication to the enum. PauseOnNotify is not clear what it means, while PauseOnSslErrors is. Any new notification in a minor release would need a new enum value otherwise applications would get pauses they did not expect. Task-number: QTBUG-19032 Change-Id: I4dbb7467663b37ca7f0551d24a31bc013968bedc Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix windows cert fetcher if site presents full chainShane Kearns2012-05-041-1/+3
| | | | | | | | | | | | | | | | | If a website presents the complete certificate chain in the handshake i.e. site -> intermediate CA -> root CA then openssl gives a different error (SelfSignedCertificateInChain) Because of this windows feature, that either means the site is signed by an untrusted CA, or the CA trust status is unknown because we don't have the root cert in the cert store. In any case, calling the windows verification function results in a trusted chain & the root being added to the cert store. Task-number: QTBUG-24827 Change-Id: I2663ea2f86cd0b4dfde105d858ec1b39a340c1f6 Reviewed-by: Richard J. Moore <rich@kde.org>
* Document new APIs in 5.0Shane Kearns2012-05-038-0/+30
| | | | | | | | The \since 5.0 directive was missing from many places. Task-number: QTBUG-24001 Change-Id: I191ba8891ae66d78f923164bcab2fccb16eabef9 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Document deprecated APIs in QSslShane Kearns2012-05-031-0/+10
| | | | | | | Task-number: QTBUG-24001 Change-Id: I8d0980bd5418e9324d0a0fe55c00b432c0a98fb1 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Document QSslCertificate deprecated functionsShane Kearns2012-05-031-4/+16
| | | | | | | | With the new functions linked Task-number: QTBUG-24001 Change-Id: I9fd2de746a6342a1f4f182189e7f2529f092c003 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Optimise windows cert fetching and fix test case.Shane Kearns2012-05-031-4/+22
| | | | | | | | | | | | | If we're not going to verify the peer, or we know in advance that windows won't have a CA root then don't ask it to verify the certificate chain. The test case started failing in CI when the windows cert fetcher was integrated due to timing change. I've relaxed the timing requirement of the test to avoid it being unstable. Task-number: QTBUG-24827 Change-Id: I694f193f7d96962667f00aa01b9483b326e3e054 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Pull in netinet/in.h. Required for definition of sockaddr_in and friends.Robin Burchell2012-05-032-1/+4
| | | | | | Change-Id: I3b1c7dc1c08ec54f5537b6019dc2554763538cfd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Implement QLocalServer::socketOptions on windowsShane Kearns2012-05-033-1/+130
| | | | | | | | | | Tested manually using the localfortuneserver example and multiple login sessions. The linux autotest isn't suitable for windows due to pipe permissions not appearing in the filesystem. Task-number: QTBUG-25147 Change-Id: I5ea4db81d1870dc45bd483fa8d0b06afede3b722 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix documentation of QLocalServerShane Kearns2012-05-031-4/+6
| | | | | | | | | Added \since 5.0 and corrected the enum documentation to match the code. Task-number: QTBUG-24001 Change-Id: I8e284b6eaaf68c46bbd0e07f4378f0c442f2edd4 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QFtp - implement fast abort for downloadsShane Kearns2012-05-031-5/+16
| | | | | | | | | | | | | | | Most FTP servers do not support the ABOR command (they don't process control channel traffic until the data channel is finished). Or they require the telnet IP & sync procedure on the control channel (this requires sending TCP urgent data, which we do not support). Following behaviour of most browsers and GUI FTP clients, abort downloads by resetting the data channel. Abort of uploads needs no change, because the client closes the data channel rather than the server. Task-number: QTBUG-25494 Change-Id: I69e7b7c04d709d26def9a4a7081074e1cbf69701 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkAccessManager - ensure abort reaches QFtpShane Kearns2012-05-031-0/+3
| | | | | | | | | Previously, we just disconnected signals from QFtp and allowed it to continue downloading in the background. Task-number: QTBUG-25494 Change-Id: I891c2fff88ef1ee554d1ccf821a3f7998eeb8406 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Stub out QDnsLookup on Android.Robin Burchell2012-05-022-0/+60
| | | | | | | | Android's resolv.h is completely crippled, so we can't use the libc resolver. Change-Id: I07e310e3561c719f4fe0bf08e58b5194f5a76e4a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Android's resolv.h is busted, so stub out QHostInfo::localDomainName().Robin Burchell2012-05-021-1/+1
| | | | | | Change-Id: Idcf5ca7298eed55121b690906885af0eb3fe0b9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Disable code using if_nameindex on Android.Robin Burchell2012-05-021-0/+5
| | | | | | | Android doesn't support if_nameindex. Change-Id: Idb0cbf52e6cffb19fe65e30430ef53626e0eeac7 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add "make docs" target for QtNetwork and sanitize other qdocconfs.Casper van Donderen2012-05-023-0/+96
| | | | | Change-Id: Ic9d6384b20162debeb69cb067c96c330c0fd999a Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Don't use obsolete qVariantValue, qVariantCanConvert, etc.Debao Zhang2012-05-022-3/+3
| | | | | | | | | | qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* QNetworkProxyFactory: check the "no_proxy" environment variableAdrien Bustany2012-05-011-2/+36
| | | | | | | | | | The QNetworkProxyFactory class considered the http_proxy environment variable, but not the no_proxy one. This commit adds no_proxy handling, loosely modeled after the way curl does it. Change-Id: Ibb9e5ffcb30fed5c95dc9fc3bc4177e20d025a50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fixed compile of QSslSocket with -qtnamespace on Windows.Rohan McGovern2012-05-012-9/+15
| | | | | | | | | | | Q_DECLARE_METATYPE must be outside of the qt namespace. System headers must be included outside of the qt namespace. Change-Id: I2f48b1df87e5edae2baee6ce813af08d3e011dc0 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Port QNetworkSession to QMetaMethod-based connectNotify()Kent Hansen2012-05-012-6/+11
| | | | | | | | The const char *-based API is deprecated and will be removed in Qt5. Change-Id: I36f6dc761e3b5a087e38db29b761c3e9237958b4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fixed iOS compilation issues.Ian Dean2012-04-261-2/+2
| | | | | | | | Put MacOS-specific code in #ifdef blocks so that it is not compiled for iOS. Change-Id: I303b7dbb63eb298e92351951731868df6a38bffa Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QHttpMultiPart: supply new line at the end of the bodyPeter Hartmann2012-04-251-2/+2
| | | | | | | | | ... to conform to RFC 2046 (section 5.1.1). Apparently IIS had problems without the new line. Task-number: QTBUG-25429 Change-Id: Ia619bbdcebd407b2716bc467323634e4c8d77bcd Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix tst_qtcpserver::serverAddress on Mac OSXShane Kearns2012-04-241-1/+5
| | | | | | | | | | | | | While linux returns the local address of dual mode sockets as "::" i.e. the IPv6 address, OSX returns "::FFFF:0.0.0.0" i.e. the IPv4 address. In the unix socket engine, treat both of these as candidates for being a dual mode socket. This should hopefully cover other unixes which we haven't tested. Task-Number: QTBUG-25445 Change-Id: If1251018d54da98618223ba538c00ba54ac4cb4e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improved detection of libcrypto and libssl.Niels Weber2012-04-241-12/+51
| | | | | | | | | | | | | | The previous solution didn't work on systems where the libraries aren't in the same location. Now we search for both libcrypto and libssl and load them if their versions match, even if they are in different directories. Task-number: QTBUG-25398 Change-Id: I37164638890586947d07670d8a59fc53a84f9c42 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix bug in qsslsocket peek()Kalle Viironen2012-04-232-0/+54
| | | | | | | | | | | | | | | | | | Calling peek() for qsslsocket caused socket data to be copied into qiodevices buffer and therefore make it unaccessible in qsslsocket. Cherry picked form 4.8-branch & modified to Qt5 API changes (int -> qintptr) Original commits: commit 621f18955082fc73471e75d1f8c35c2dcd4befeb Author: Shane Kearns <ext-shane.2.kearns@nokia.com> commit 68b1d5c17aa38d5921bdade2b0e0cb67c6c90513 Author: Kalle Viironen <kalle.viironen@digia.com> Task-number: QTBUG-18498 Change-Id: I6be4b19baec2f3197537f5e7b61432040ec84ad2 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows - "bypass proxy for local..." also affects IP addressesShane Kearns2012-04-201-2/+19
| | | | | | | | | | | | | | | | If the "bypass proxy for local addresses" option is enabled in the windows proxy configuration, then do not use the proxy for any IP address in the subnet of any network interface. As the systemProxyForQuery api is now offering HTTP proxy tunnels for TCP sockets, this change avoids local ad-hoc network connections being routed through the proxy. In the case where the local address was on a different interface to the proxy server, it may have been unreachable through the proxy. For example IP over USB or Bluetooth. Change-Id: I0842732832a7795112be029d923ed168edc008d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSslSocket: call to ERR_free_strings to free loaded error stringsMartin Petersson2012-04-203-0/+5
| | | | | | | | | | Since we are calling q_SSL_load_error_strings to load error strings we should call ERR_free_strings to free the memory again. Task-number: QTBUG-15732 Change-Id: Ie41291bb0e1434f82025378edfca51930712a8aa Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Abort background requests if policy changes to disallow themShane Kearns2012-04-192-9/+37
| | | | | | | | | | | | | Using the policy change signal from QNetworkSession. If the new policy disallows background requests and this is a background request, then generate an error. This results in a TCP RST on the socket, and a BackgroundRequestNotAllowedError on the QNetworkReply. If the reply is already finished, no action is taken. Change-Id: I4ff5c681a8b7b852727bb95f03664d666f4efe07 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Connect usagePoliciesChanged signal to the QNetworkReplyShane Kearns2012-04-194-0/+20
| | | | | Change-Id: Ibb8ba0b3226e402dfa9a5a1a64faa80702b11dd7 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Set ConnectInBackground also for http implementationShane Kearns2012-04-191-1/+3
| | | | | Change-Id: Id82322250d86f35702036c64d725c9d093046d5b Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* fix qsslsocket build in -permissive mode (assigning const char* to char*)Konstantin Ritt2012-04-191-1/+1
| | | | | Change-Id: I76269630ebabdf601c2fcb5f65a8dffbd6cdbc5e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Change coreservices -> iosIan Dean2012-04-193-6/+6
| | | | | | | | Replace "contains(QT_CONFIG, coreservices)" with "!ios" in config files. Replace "QT_NO_CORESERVICES" with "Q_OS_IOS" in source files. Change-Id: Id3b02316b245a24ce550e0b47596d18a4a409e4f Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-04-1727-190/+206
|\ | | | | | | Change-Id: I964b0a6f5c38351fdfafb8a2a128a349ff8c89d1
| * Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-1611-90/+515
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * | Fix error reporting in QNetworkReplyHttpImplPrivateShane Kearns2012-04-111-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When errors are detected synchronously in _q_startOperation, they were not reported. This is because unlike the generic QNetworkReplyImpl the function is called directly rather than using a queued connection. In order to report errors, use the _q_error and _q_finished slots so that signals are emitted after returning to the event loop i.e. after the application had a chance to connect the QNetworkReply Change-Id: I8a7bbe79a934f4634fb4e0572ebb5479dfc5f489 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Add autotest interface to get session from QNAMShane Kearns2012-04-112-0/+12
| | | | | | | | | | | | | | | | | | Change-Id: I7d8ea41299408377042a9f0d0a672e1a6fb57e7d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Check background requests are allowed before startingShane Kearns2012-04-112-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If background requests are not allowed, don't even attempt to start the network session, just fail the request immediately. After this change, a QNAM with mixed requests queued should behave as follows when background requests are disabled: - background requests at head of the queue fail - first foreground request starts the session and succeeds - remaining background requests fail - remaining foreground requests succeed If policy is changed on the fly, then running background requests are not aborted. However queued background requests won't be started. Change-Id: Ic9aba1eb59ca41b166a08d2ed09418e1b6af6b60 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Define usagePolicies API in QNetworkSessionShane Kearns2012-04-113-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the system to publish usage restrictions to applications related to the network in use. Currently there is only one restriction defined: NoBackgroundTrafficPolicy, which means that non user initiated traffic should be avoided (e.g. background downloads). For example this policy could be applied to save battery or data transfer charges. Change-Id: I49e26c0f3650d2b92f4ec51981aae9435b717b49 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | Use NetworkSessionFailedError in QNetworkReplyShane Kearns2012-04-113-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Switched the error code. Republish the error string from the bearer plugin if possible. Change-Id: I9e4ac7a9914fbf2e87fe8fd3a5175deda6d933d2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Define QNetworkReply::BackgroundRequestNotAllowedErrorShane Kearns2012-04-112-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error will be used when background network requests are not allowed according to the current policy of the bearer plugin. For example, to save power when battery is low on a portable device. Change-Id: I866e115f8fdd046134da99ea895b7c1df0375f26 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Define QNetworkReply::NetworkSessionFailed errorShane Kearns2012-04-112-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is to replace the UnknownNetworkError which occurs when the internal QNetworkSession fails to start (e.g. no usable WLAN available) Change-Id: I2b14577c22e0acf8ff07be7e932f0dfe9ac89c33 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Set ConnectInBackground based on requestShane Kearns2012-04-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set the QNetworkSession attribute to match the QNetworkRequest that triggered it. Currently if there are a mix of normal and background requests queued and background connections are not allowed by policy: - background requests at the head of the queue should fail - first foreground request should successfully start a connection - remaining requests succeed regardless of background attribute Change-Id: If0e3ec0b8a5096e3d7cd6df85884c6f53172d233 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Define BackgroundRequestAttributeShane Kearns2012-04-112-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is so that the ConnectInBackground flag can be set on the QNetworkSession internal to QNAM according to pending requests. Change-Id: If0cc62f5117ed8febbbda7b7f6de62b11b274258 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
| * | Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>