summaryrefslogtreecommitdiffstats
path: root/src/network/socket
Commit message (Collapse)AuthorAgeFilesLines
* Windows - fix getsockopt calls for narrower than int optionsShane Kearns2012-03-011-5/+7
| | | | | | | | | | | | | | | | | | | | | | Windows unhelpfully writes to only one byte of the output buffer when getsockopt is called for a boolean option. Therefore we have to zero initialise the int rather than initialising to -1 as was done before. This in general only works for little endian architecture, because the word would look like 0x01000000 on big endian. So I have added some compile time asserts in the assumption that windows is always little endian. This is ok for comparisons with 0/false, but not comparisons with true or nonzero values. In the case of IPV6_V6ONLY, it is documented as DWORD (unsigned int) but on some windows versions it is returned as a boolean triggering the warning. I removed the warning, as the conversion to int works on both LE and BE since it is only compared with zero. Task-number: QTBUG-23488 Change-Id: I3c586d1ada76465fc045a82661f289920c657a4c Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
* Fix error in addrlen fieldAndrew Stanley-Jones2012-02-211-1/+1
| | | | | | | | addrlen must be initialize to the amount of space available in the buffer. Change-Id: I52945d780bba9d22aeaa7ac5a35a0e54dbea60dc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Test for QT_NO_SSL instead of QT_NO_OPENSSLShane Kearns2012-02-211-3/+3
| | | | | | | | Change the ifdefs in our own code (except openssl backend) to use the new configure flag. Change-Id: I8774734771c66b22164b5fae8fdb27814ac3df7b Reviewed-by: Richard J. Moore <rich@kde.org>
* Windows - fix connecting to a socket using IPv4 mapped IPv6Shane Kearns2012-02-201-0/+10
| | | | | | | | | | | | Connecting to an IPv4 mapped IPv6 address (e.g. ::FFFF:127.0.0.1) requires the IPV6_V6ONLY socket option to be cleared. This was causing tst_qtcpserver::ipv6ServerMapped autotest to fail. The same change is not required on MacOS X - the test passes there. Task-number: QTBUG-24351 Change-Id: I6c08b19f0daa12765da2d44792ffb17299322695 Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Qt Network: Added the \inmodule command in the class documentation.Michalina Ziemba2012-02-162-0/+2
| | | | | | | | -Some of the public classes were missing the \inmodule command. -Fixed a sentence. Change-Id: I88ebe12680c744e32253dc01c5ddb4292267caf9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Allow the QLocalServer to listen to a native descriptorAndrew Stanley-Jones2012-02-156-0/+91
| | | | | | | | | | | | | QLocalServer could only listen to sockets it created. Thi is not always possible as sockets may be passed by socketpair() or have to be created locally by other means. This adds a similar feature to QLocalSocket where a native descriptor maybe used. Change-Id: I43b0af179b3b868dd164d4e1fd312ff4546cf9ff Reviewed-by: Michalina Ziemba <michalina.ziemba@nokia.com> Reviewed-by: Tapani Mikola <tapani.mikola@nokia.com> Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
* Add socketOptions flags to QLocalServerAndrew Stanley-Jones2012-02-104-3/+145
| | | | | | | | | | QLocalServer had no way to set socket options that more complicated servers require. The first set of options allow setting of access control on the sockets. Change-Id: If4268c66462fc2e6cf1e70b1d5f56c76d2c69228 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
* MinGW: Fix warnings.Friedemann Kleint2012-02-042-1/+3
| | | | | | | | - Special #define to access HB seems no longer necessary (it was causing about mismatching DLL import attributes). Change-Id: I57cc7d57b12a67c1d549b053db81e1f198f87786 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Emit QSslSocket::error in case of openssl gives an error.Jonas M. Gastal2012-02-012-0/+6
| | | | | | | | | | | Create new QAbstractSocket::SocketError value that denotes a error in the SSL library: SslInternalError Create QAbstractSocket::SocketError value that denotes a error in data provided by user cauding an SSL library error: SslInvalidUserDataError Change-Id: I466a9389d9d7052efd8eddd1a2d6067ba26dfddb Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
* Fix debug format string in windows socket engineShane Kearns2012-01-301-2/+2
| | | | | | | %l has no meaning, should be %li according to the arguments. Change-Id: Ife9ec524109e021ad723865445e80b6bad51a5c6 Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix crashing debug messageShane Kearns2012-01-301-1/+1
| | | | | | | | The debug message could derefence a null pointer, this crashed when running ssl autotests Change-Id: I176aaa9f3cf3c6cc1512cdc34db06d4c79f92e73 Reviewed-by: Richard J. Moore <rich@kde.org>
* Make the pause modes a QFlags.Richard Moore2012-01-303-7/+9
| | | | | | | | | | | The intention is to add additional pause modes over time, this will be easier if we can just test if a particular reason for pausing is turned on. If we don't do this we'll end up having to check for each enum value every time we check what is enabled. Change-Id: I6b08f0e819b5593e3f6463c3dd175eff8625e155 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com> Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3033-33/+33
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QAbstractSocket / QSslSocket: add API to pause and resumePeter Hartmann2012-01-253-0/+73
| | | | | | | | | | | | | | | pause and resume is currently only supported upon emitting the QSslSocket::sslErrors() signal. The API was added in QAbstractSocket to also support QAbstractSocket::proxyAuthenticationRequired() in the future. This is the first patch to support that feature on the socket level, another patch will follow to support sslErrors() and authenticationRequired() in QNetworkAccessManager / QNetworkReply. Task-number: QTBUG-19032 Change-Id: Ide2918268590ab9a01454ab26cb7fdca3dc840ab Reviewed-by: Shane Kearns <ext-shane.2.kearns@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-256-6/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove reference to Symbian in QtNetwork.Xizhi Zhu2012-01-241-3/+0
| | | | | | | Change-Id: Iae377505e36ae1239be7ce52c773dc2a4f4a9767 Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make QAbstractSocket's API virtual where needed.Jonas M. Gastal2012-01-242-50/+7
| | | | | | | | | | | | | | | | | | | | The following methods have been made virtual: setReadBufferSize() socketDescriptor() setSocketDescriptor() socketOption() setSocketOption() waitForConnected() waitForDisconnected() Now that these methods are virtual we no longer need the nasty polymorphism workarounds for QSslSocket. Change-Id: I319989b6cdb025ba33d7d53ae90f3a6a3b6b1b7b Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update contact information in license headers.Jason McDonald2012-01-2333-33/+33
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Removing QHttpHeader and QHttpResponseHeader.Jonas M. Gastal2012-01-192-27/+30
| | | | | | | | | QAuthenticator used it for the convinience of QHttpSocketEngine only. QHttpSocketEngine has now been ported to use QHttpNetworkReply to parse HTTP responses. Change-Id: Idf6e70aa76613aad6e3d789d81ca1b4fd73575c2 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* qdoc3: Don't put a \table in a \valueMartin Smith2012-01-131-10/+19
| | | | | | | | | | | | | | | | | | | | In qdoc, the \value command is meant to document a single value of an enum. e.g. \value TypeOfService Text describing the type of service. It runs until the next \value or a blank line. Although it doesn't say you can't build a \table in the \value text, it doesn't work. For now, the fix is to remove the \table from the \value text and make the table separate from the enum \value list and let the description of the \table refer to the value that it belongs to. Task-number: QTBUG-23599 Change-Id: I88b456dca419a565eece30ba20fe09c0bcd4d98d Reviewed-by: Martin Smith <martin.smith@nokia.com> Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make QFtp private.Jonas M. Gastal2012-01-122-2/+2
| | | | | | | | | All references to QFtp in documentation have been removed, QFtp's documentaiton was marked internal. The QFtp example was removed. Task-number: QTBUG-23199 Change-Id: Ifff83cac069fb350e8ebeae63e605850e65c0c30 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* qlocalsocket_win.cpp: Fix compiler warning.Friedemann Kleint2012-01-111-1/+1
| | | | | | | Change-Id: Ibdb57f99b98b0c603be3c9be043737687034a958 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* QLocalSocket: make socket descriptor qintptrJoerg Bornemann2012-01-105-12/+12
| | | | | | | | | | | This is consistent with the other socket classes. Also see commit bf7f17060773803f332e8c729a70f47b94243890. Change-Id: Ic4bf01bd4abf778e21fe575c5304f86c9bee82fc Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Make (dis)connectTo(From)Host virtual in QAbstractSocket.Jonas M. Gastal2012-01-092-40/+4
| | | | | Change-Id: Ib1dfae4031f00fb331108152a259f6a2756381c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Removing QHttp class, its tests and its usage in examples.Jonas M. Gastal2012-01-061-1/+1
| | | | | | Task-number: QTBUG-22750 Change-Id: I161fad772bfb26797e6ee9d69da925b6747c371f Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make socket descriptors qintptr.Jonas M. Gastal2012-01-0514-44/+44
| | | | | | | | | | Windows x64 uses 64 bits integer for sockets, to ensure compatibility we should use ptr sized integers for our socket descriptors. Task-number: QTBUG-19004 Change-Id: I4b56023874a4f1bad107c66c054fecfedde33d88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-0533-33/+33
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Emit error if trying to connect while socket is connected or connecting.Jonas M. Gastal2012-01-047-4/+25
| | | | | | | | | This applies to both local and abstract sockets. Task-number: QTBUG-22450 Change-Id: I5c58d68da95ffb6bcde5be510853359b288e5984 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* QLocalSocket shouldn't emit disconnected if it isn't connected yet.Jonas M. Gastal2011-12-271-1/+1
| | | | | | Task-number: QTBUG-22082 Change-Id: I2e1dae133f50a232d4be3ff63cafaf1b417b286c Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Don't fetch credentials from cache following a failed proxy authenticationShane Kearns2011-12-222-3/+18
| | | | | | | | | | Add variable to QAuthenticatorPrivate for tracking failure Track authentication success/failure in http proxy socket engine Track authentication success/failure in http connection channel Task-number: QTBUG-22875 Change-Id: Id5d39e839428271ad687e9da12fbbdea9c478f4f Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* QNetworkAccessManager: fixed foreach copy of host addressMartin Petersson2011-12-221-1/+1
| | | | | Change-Id: I50cb113fb3c803fc5b13c74b3f7ad1fc4283065b Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Add ToS option to sockets.Jonas M. Gastal2011-12-225-2/+43
| | | | | | | | | | | | | | Creates a new SocketOption called called TypeOfServiceOption that can be used with the existing setSocketOption method to set the ToS byte in a socket socket. This is done only for unix systems because windows doesn't support directly setting the ToS/DSCP byte: http://support.microsoft.com/kb/248611 http://blogs.msdn.com/b/wndp/archive/2006/07/05/657196.aspx Change-Id: Idf9da2dd8307ac7057982fbfdf9e4e9ebe366780 Task-number: QTBUG-6221 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* extract QWindowsPipeReader from qlocalsocket_win.cppJoerg Bornemann2011-12-163-227/+36
| | | | | | | | The code for reading named pipes can now be used in other places as well. Change-Id: Id734617a3927e369491a6c5daf965169ceb01f74 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QLocalSocket/Win: eliminate checkReadyRead()Joerg Bornemann2011-12-151-18/+5
| | | | | Change-Id: I459c0ba42d3e5b0da57884f5cdfc6f44a11600f7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QLocalSocket/Win: make emitReadyRead timer persistentJoerg Bornemann2011-12-153-20/+9
| | | | | | | | | | This saves us from creating a single shot timer every time we emit readyRead and eliminates the parallel pendingReadyRead flag. Done-with: ossi Change-Id: I1de7f07b83b583b9d60dd8862d6a9f7865b5b891 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QLocalSocket/Win: fix behaviour on broken pipeJoerg Bornemann2011-12-151-38/+39
| | | | | | | | | | We must not close the QIODevice, if we detect a broken pipe. We still can have data in our read buffer that can be read by the user. Autotest: tst_QLocalSocket::threadedConnection Change-Id: Ibe823c006516acb27f51a06ca0bbe5555dbd88f5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix QTcpServer::serverAddress() for dual stack socketsShane Kearns2011-12-012-0/+31
| | | | | | | | | | When listening on QHostAddress::Any, serverAddress() should return QHostAddress::Any too, assuming that setting the socket options was successful. Task-number: QTBUG-22899 Change-Id: I50a9ff1b4ad0c1c1905e2952c595d7068df2627d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QWinEventNotifier part of the public APIDebao Zhang2011-12-012-2/+2
| | | | | | | | | | | | QWinEventNotifier is an essential class if you're using native Windows Overlapped IO and need to convert it to Qt signals. However the header is marked private. Task-number: QTBUG-68 Change-Id: I22e9a84da97f969ddb82e9ba15e604a01abd80d0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Removing unnecessary hidden property "_q_user-agent".Jonas M. Gastal2011-11-242-13/+2
| | | | | | | | | This property is no longer necessary because we can now set the user agent directly on the proxy. Task-number: QTBUG-17223 Change-Id: I27cb126dd401f02525290d2317650f55cae9f4ef Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Adds support for headers in QNetworkProxy.Jonas M. Gastal2011-11-241-9/+14
| | | | | | | | | | | | | | | | The API is the same that is present on QNetworkRequest class. Since these are HTTP headers, this only affects proxies of type HttpProxy and HttpCachingProxy. This was created as a general solution to the problem pointed out in QTBUG-19569(some proxies only accept request with specific User Agents). In the same way that there are cases where setting the User Agent is desired there might be reasons to set other headers, hence the support for any header. Change-Id: Ifd04f34d29eedb6c2a3f0b50708244996b12a123 Task: QTBUG-19569 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* 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>