summaryrefslogtreecommitdiffstats
path: root/src/network/socket
Commit message (Collapse)AuthorAgeFilesLines
* Fix sporadic hang in QLocalServer::close() in OS X 10.7Robert Knight2011-11-181-4/+4
| | | | | | | | | | | | | | | | | | | | There is a bug in CFSocket/CFRunLoopSource in OS X 10.7 which can lead to a deadlock in CFRunLoopRemoveSource or CFRunLoopSourceInvalidate if the CFSocket manager thread is concurrently calling CFSocketInvalidate as a result of the socket's file descriptor having been closed. QLocalServer::close() triggers this race by closing the socket fd before unregistering the QSocketNotifier, which internally uses CFSocket. This commit fixes the problem by changing the ordering in close() so that the socket notifier is disabled before closing the file descriptor. This change also makes QLocalServer::close() perform operations in reverse order to QLocalServer::listen(), as would be expected. Task-number: QTBUG-22789 Merge-request: 1470 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit a9c3f7169faf4621d39714f753d6e8b376c5d6e5) Change-Id: Ia9c3f7169faf4621d39714f753d6e8b376c5d6e5
* network: remove Symbian specific codePeter Hartmann2011-11-1411-2119/+3
| | | | | | | | removes several files and cleans up the code, removing all Symbian specific #ifdef's etc. Change-Id: Ie457e54cb4b3a992f251383320d47822259c38f1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* HTTP proxy engine - accept standard Connection headerShane Kearns2011-10-311-0/+4
| | | | | | | | | | | | The Proxy-Connection header is a non standard header, but is widely used so forming a de-facto standard. Some proxies use the official Connection header, so we should check for that in responses. Otherwise https connections over http proxy fail in case the proxy sends "Connection: close" with the 407 reply. Task-number: QTBUG-22177 Change-Id: If6cfa4ebb7ac9d97d65b6ddcc8257aee20ac0448 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Remove Symbian support from bind enum documentation.Robin Burchell2011-10-311-7/+0
| | | | | | | | Symbian is no longer a supported platform. Change-Id: Ifcb2e05661b16acc6307a4ccfaa42586750734c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Move support for socket binding from QUdpSocket upstream to QAbstractSocket.Robin Burchell2011-10-314-171/+151
| | | | | | | | | This should be API-compatible with Qt 4, but is not ABI-compatible, due to removing the enum from QUdpSocket. Task-number: QTBUG-121 Change-Id: I967968c6cb6f96d3ab1d6300eadd5bde6154b300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Set localAddress and localPort on socket binding.Robin Burchell2011-10-312-0/+6
| | | | | | | | | This should have always been the case, as it simply makes sense, but the upcoming moving of binding to QAbstractSocket will require this for autotesting. Change-Id: Ieef70196616227e7914c76fff5388a4068c36efb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Network - Use isLoopback API in place of existing localhost checksShane Kearns2011-10-244-6/+4
| | | | | | | | | | Various places in QtNetwork checked for Localhost or LocalHostIPv6, i.e. 127.0.0.1 or ::1. By using the isLoopback API, other loopback addresses are treated the same way (e.g. 127.0.0.2 and ::ffff:127.0.0.1) Task-number: QTBUG-22246 Change-Id: I46f55630d8646fd68034a509969a0b7cb72ca77c Reviewed-by: Thiago Macieira (Intel) <thiago.macieira@intel.com>
* Replace Q_WS_WIN by Q_OS_WIN in uic/network.Friedemann Kleint2011-10-171-2/+2
| | | | | Change-Id: I592936859f6932fcd1aa47f0617ba9f8efee86dc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* QAbstractSocket: Always clear old QHostAddress list on a new connect.Martin Petersson2011-07-061-0/+1
| | | | | | | Change-Id: Iee1416e7803836e5f1a37508739bcbcb2cdb421c Reviewed-on: http://codereview.qt.nokia.com/1174 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Remove QT3_SUPPORT from networkShane Kearns2011-07-052-114/+0
| | | | | | | Change-Id: I962bece24c958c053a3edc0e49a594b61a3725ae Reviewed-on: http://codereview.qt.nokia.com/1093 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Always assume IPv6 supportMarkus Goetz2011-07-045-112/+12
| | | | | | | | | | | It's 2011 baby! And until Qt5 is released probably 2012 :-) Change-Id: I397aabf25e93c8afb5f562636710985cf0c7acfa Reviewed-on: http://codereview.qt.nokia.com/1008 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com> Reviewed-by: Markus Goetz
* Add Happy-Eyeballs style IPv6 connection establishing.Martin Petersson2011-07-043-4/+20
| | | | | | | | | | | | | | | | In the cases where a DNS lookup will give you both an IPv4 and IPv6 address, this will start two connection channels at the same time. One trying to connect using IPv4 and one on IPv6. This is done so that we can use the fastest one for the connection. To do this we have to do the hostlookup in the connection. The result is then in the cache for the individual socket so it will not need to do another lookup. Task-number: QTBUG-16458 Change-Id: I806c20168d9c5edc2831b80f82a2bd570b36d5fa Reviewed-on: http://codereview.qt.nokia.com/1003 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* IPv4 + IPv6 dual stack socketsShane Kearns2011-06-225-17/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds support for binding "dual stack" sockets (via QUdpSocket or QTcpServer). A dual stack socket will accept incoming connections on either IPv4 or IPv6 interfaces. QHostAddress::Any - use this to bind a dual stack socket QHostAddress::AnyIPv6 - use this to bind a socket for IPv6 only QHostAddress::AnyIPv4 - use this to bind a socket for IPv4 only Binding to a specific address rather than one of the "any" addresses is restricting you to a protocol anyway so no behaviour change there. IPv6 sockets were previously dual stack on some OS and v6 only on others Any previously meant IPv4 only This commit implemented & tested on Windows 7, Linux (Ubuntu 10.04) and Mac OS 10.6.7. Windows XP and server 2003 do not support dual stack sockets, even though they can support IPv6. On those versions, QHostAddress::Any will still bind to IPv4 0.0.0.0 (which is also the behaviour anywhere QT_NO_IPV6 is defined) Autotests run: qudpsocket (includes a new test case) qtcpserver (includes a new test case) qtcpsocket qnetworkreply qhostaddress Task-number: QTBUG-17080 Change-Id: Id486677c4f832e18dc0ff1a86c5f5fc422c9eb4f Reviewed-on: http://codereview.qt.nokia.com/421 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com> Reviewed-by: Markus Goetz
* Fix regression that caused waitForXXX(-1) to fail.Thiago Macieira2011-06-071-1/+1
| | | | | | | | | | | | | | | | | | | Regression was introduced by 8d4cd52b6981a4e6deea7fdb77f56e40c4f3e6ba when it failed to check when msecs == -1. This manifested visibly in KDE failing to connect to any SSL site -- kioslaves are synchronous and use waitForXXX(-1) (in this particular case, waitForEncrypted, which calls waitForReadyRead). Also, take the opportunity to convert these tests in QTcpSocket to use port 80 (a defined service in the test server) instead of port 22. Reviewed-by: Martin Petersson (cherry picked from commit cb5b6799333794496269aa7e6515f96c2ac96d37) Change-Id: I256a1e138e43fd45844976fe84cd2bc938552e47 Reviewed-on: http://codereview.qt.nokia.com/359 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* sockets: limit buffer size of the internal sockets in proxy enginesShane Kearns2011-06-012-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The application can normally control the amount of buffering of a socket or QNetworkReply by using the setReadBufferSize API. This allows the application to flow control the TCP connection, and avoids out of memory errors when the data being downloaded is received faster than the application can process it. However when using a proxy, the proxy socket engine has an internal socket which is used to communicate with the proxy server. It is not visible to the user, and does not have awareness of the buffer size of the external socket. To solve this, we limit the internal sockets' buffer size to 64k bytes. Under normal operation, the data is swiftly copied to the external socket where the buffer can grow (or not) based on the application's set value for read buffer size. Task-number: QT-4966 Reviewed-by: Markus Goetz (cherry picked from commit c4727a85eed57a4db698326a1bed4aa75b6e5284) Change-Id: I29e6628e38b79b41c4464ba8cb772a0f03717043 Reviewed-on: http://codereview.qt.nokia.com/153 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Markus Goetz
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-2435-595/+595
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Sockets: Fix potential null pointer usagesShane Kearns2011-05-112-8/+13
| | | | | | | | | QAbstractSocketEngine::createSocketEngine can return 0 as well as throw. In two cases the pointer was being used before the null check, in a 3rd case the null check was missing. Reviewed-by: Markus Goetz (cherry picked from commit 19edac88af53eea7f733cabbaee77f9b725b7ea9)
* Optimisation - buffer packet read in pendingDatagramSizeShane Kearns2011-05-112-9/+56
| | | | | | | | | | | | | | | | | | In Symbian, the OS function to get the size of a pending datagram also includes the size of the packet header (which is different for IPv4 and IPv6). We were reading the datagram with the "peek" flag set to implement pendingDatagramSize, then reading again normally when the client called read/readDatagram. This change removes the "peek" flag, and buffers the datagram in the socket engine, returning it and clearing the buffer when read or readDatagram is called. If there is no buffered data, the existing code path is followed - it isn't mandatory to call pendingDatagramSize before reading from the socket. Reviewed-by: Markus Goetz (cherry picked from commit dd8de4c2437397748daba49569cbc7f89a8bfbee)
* Remove warnings when disabling notifications on a closed socketShane Kearns2011-05-111-6/+1
| | | | | | | | | | | The generic layer calls setReadNotificationEnabled(false) on sockets after they are closed. This no longer causes a warning from the symbian socket engine. A warning will only be emitted if trying to enable notifications on a closed socket. Task-number: QTBUG-18713 Reviewed-by: Markus Goetz (cherry picked from commit 0aa780235c24ed724fcf6a9095a6467e34b9346e)
* Send User-Agent from the network request in http proxy CONNECT commandShane Kearns2011-05-092-1/+11
| | | | | | | | | | | | | Some proxies can discriminate based on the User-Agent when sent a CONNECT command for establishing a HTTPS connection. With this change, if the User-Agent header is set in the QNetworkRequest then it will be passed to the http socket engine for use in the connect command sent to the proxy. As before, "Mozilla/5.0" will be used by default when no user agent has been set. Task-number: QTBUG-17223 Reviewed-by: Markus Goetz
* Fix error handling in write for socks socket engineShane Kearns2011-05-091-1/+6
| | | | | | | | When socks socket engine calls the write function of the native socket engine, it now propagates errors to the abstract socket. Task-number: QTBUG-18713 Reviewed-by: Markus Goetz
* QAbstractSocket: Fix waitForReadyRead infinite loop.Martin Petersson2011-05-021-2/+2
| | | | | | | | Make sure that waitForReadyRead times out if the read buffer is full. Task-number: QTBUG-16123 Reviewed-by: Peter Hartmann (cherry picked from commit 8d4cd52b6981a4e6deea7fdb77f56e40c4f3e6ba)
* Initial import from the monolithic Qt.Qt by Nokia2011-04-2736-0/+18935
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12