summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright year in license headers.Jason McDonald2012-01-05158-158/+158
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix compiler warnings in QtNetwork.Friedemann Kleint2012-01-052-3/+2
| | | | | | | | | - Initialization order in QHttpNetworkConnectionChannel - Potential use of uninitialized value in QNetworkReplyDataImpl Change-Id: Ia405147ef81a3f1509149349d6b5b01bb078f853 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@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>
* Always load the openssl configuration.Richard Moore2012-01-031-4/+0
| | | | | | | | | | | | This change makes Qt load the default openssl config always, not just when compiled with OPENSSL_LOAD_CONF. This means that facilities like openssl engines (and their configuration) are usable. An alternative would be to call OPENSSL_config(NULL) ourselves, but that's exactly what the OPENSSL_add_all_algorithms_conf does for us. Task-number: QTBUG-16018 Change-Id: I4cda701f82627e0541b6225009f4e1249aec9d47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make qDecodeDataUrl return bool.Jonas M. Gastal2011-12-292-10/+6
| | | | | Change-Id: I23b9fed39af7bea6c171b35e10bd72c424bd903e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clarifying the flow of signals on QNetworkAccessManager.Jonas M. Gastal2011-12-282-1/+10
| | | | | | | Task-number: QTBUG-22858 Change-Id: I07eaecebf17e73f9c3148465d8970ca7672a900c Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* Fix http authentication to a different realm on the same serverShane Kearns2011-12-221-4/+2
| | | | | | | | | | This is a regression caused by the NTLMv2 authentication patch. I have manually tested NTLMv2 authentication against MS IIS and reverting these two lines does not break it. Task-number: QT-5209 Change-Id: I64159cbe468e1a7f834f8726fd0c9d4ab4c54b38 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Fix race in http connection channelShane Kearns2011-12-222-1/+3
| | | | | | | | | | When authentication is cancelled, close the channel instead of the underlying socket. The previous behaviour could result in further requests being sent on the closed socket, which caused errors in case of https over a proxy. Change-Id: I3dbfc164de4fb29a426c06acaac8f29b9da1d705 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Don't fetch credentials from cache following a failed proxy authenticationShane Kearns2011-12-228-13/+52
| | | | | | | | | | 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>
* Handle plain socket write errors in SSLShane Kearns2011-12-221-2/+9
| | | | | | | | | | | | | | When an ssl socket is closed during connecting, and it is using a proxy then it is possible for the plain socket to be in pending close state when transmit() is called. As errors were not handled, this caused the socket (and https request) to "hang". It now propagates the error from plain socket. Change-Id: I6fb86815a2a63e197cea582f4b153e487543477c Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix for assertion failureShane Kearns2011-12-222-1/+6
| | | | | Change-Id: I97b9ecc37e938a3050793fc746288243a1cb40b7 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Fix faulty logic in http connection pipeliningShane Kearns2011-12-221-2/+6
| | | | | | | | | The code which prevents pipelining of requests when authentication is in use had || where && should have been used. Also check for blank user with a password. Change-Id: Ic278cedd370c9d81377f49a0af43aef415cb49ad Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* QNetworkAccessManager: fixed foreach copy of host addressMartin Petersson2011-12-222-2/+2
| | | | | 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>
* SSL: fix build with -openssl-linked for OpenSSL 0.9.8*Peter Hartmann2011-12-223-12/+0
| | | | | | | | | | | | | | | OpenSSL's SSL_ctrl() always took a "void *" argument as 4th parameter, since at least version 0.9.7. I have no idea why we had "const void *" in there. Reviewed-by: Richard J. Moore <rich@kde.org> Task-number: QTBUG-23132 (cherry picked from commit 4db91cbd6147e40f543342f22c05b7baddc52e5a) Change-Id: Ie570e1cc59b72f13d3e6f3ed6fc1892444a63743 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkAccessManager: delay IPv4 or IPv6 based on getaddrinfo orderMartin Petersson2011-12-223-18/+35
| | | | | | | | | | | | Instead of always delaying IPv4 when we have both Ipv4 and IPv6 we should use the order we get from getaddrinfo to descide which one that should be delayed. Task-number: QTBUG-23066 Change-Id: Ibe8c4d7000abd6e57fe8c6afac8a4a843e17ff27 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix regression in user-agent setting of http proxy in a QNetworkRequestShane Kearns2011-12-191-2/+5
| | | | | | | | | | | Modifying the proxy causes a detach(), so the socket is still using the unmodified proxy. Changed this to setProxy() the modified one back to the socket. Test case tst_QNetworkReply::httpProxyCommands() Change-Id: I448c2f2ab43ce8d78bc6edb8261599bf67372676 Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
* QNetworkAccessManager: delay IPv4 connection with Happy EyeballsMartin Petersson2011-12-163-1/+31
| | | | | | | | | Incase we have both IPv4 and IPv6 available after the host lookup we should delay the connection attempt to IPv4. Task-number: QTBUG-23066 Change-Id: I8c0177cf125c9daae314ada73cacef790a39b856 Reviewed-by: Peter Hartmann <peter.hartmann@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>
* Remove unused member variables from private class.Richard Moore2011-12-121-2/+0
| | | | | | | These aren't used, and so they shouldn't be there. Change-Id: Id4a08d90836c45c140d811b8eca07756e14c56e5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix NTLM authentication with email addressShane Kearns2011-12-121-8/+3
| | | | | | | | | | | | | | | When using "user@dns-domain" for NTLM authentication, the whole string should be sent as the username, and the domain should be set to an empty string. The domain sent by the server is still reflected if the username does not contain an '@' character. Manually tested using MS IIS on a domain-joined PC. Task-number: QTBUG-19894 Task-number: ou1cimx1#949951 Change-Id: Ie1f81172e71cb7cce7b8c909062be990c24aea47 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Fix null pointer dereference in NTLM authenticationShane Kearns2011-12-121-2/+5
| | | | | | | | | | | If NTLM authentication is required for the URL with an empty path, then QNetworkAuthenticationCache::findClosestMatch(url.path()) returns 0. e.g. "http://10.1.2.3". Return a default constructed credential in this case. Change-Id: I84ad3b308ee3f74fbbac9ad0f11dbdc66047b50b Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkAccessManager: check the buffer size before allocateMartin Petersson2011-12-071-5/+9
| | | | | | | | | | The downloadBuffer size should not be larger then the downloadBufferMaximumSize. I also added a try catch for the allocation incase we are low on memory, so that we don't crash. Task-number: QTBUG-23040 Change-Id: Ib9820bc19fc5db994ede20f123f8c167a8d43ff7 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Check we're connected before startClientEncryption()Richard Moore2011-12-071-0/+4
| | | | | | | | | The docs say this is required, but we don't check it and instead segfault right now. Change-Id: I825b00a312a481c5383af127333c0c4698188348 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Peter Hartmann <peter.hartmann@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>
* Fix QHostAddress::operator==(QHostAddress::SpecialAddress)Shane Kearns2011-11-301-0/+2
| | | | | | | | | QHostAddress(QHostAddress::Any) was not equal to QHostAddress::Any because only one of the operator== overloads was handling this. Task-number: QTBUG-22898 Change-Id: Ifd36947a50e8c36362b4e850fd8d5105ee0925ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the default ssloptions testable.Richard Moore2011-11-292-2/+7
| | | | | | | | | Centralise the specification of the default ssloptions to make the code clearer and more testable. Change-Id: I4f4bae72736dd063ee4cd64c6375e82d0600a105 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* SSL certificate blacklist: reformat serial numbers to hexadecimalPeter Hartmann2011-11-251-10/+10
| | | | | | | | | | Since recently QSslCertificate::serialNumber() always returns the hexadecimal format, so we need to adapt to that when checking the serial numbers for the blacklisted certificates. Change-Id: I43bdb1be77faad7ad79a835c896fc39477452e75 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* SSL: fix build when compiled with -openssl-linkedPeter Hartmann2011-11-252-0/+12
| | | | | | | | | ... and only resolve the functions when the methods are available. SSL 2 functionality is not always available in OpenSSL anymore. Change-Id: Ia3178685b26c67ac55447476789e06710b596181 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Removing unnecessary hidden property "_q_user-agent".Jonas M. Gastal2011-11-244-16/+3
| | | | | | | | | 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-243-9/+137
| | | | | | | | | | | | | | | | 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>
* Don't forward declare types form openssl in public headersLars Knoll2011-11-241-2/+0
| | | | | | | | | | There's no real reason for the typedef here, QtNetwork will compile without it and it might conflict with openssl. Change-Id: Id352ccc98d84ca9ee9ea3c7b4a942382882173f1 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkProxy documentation: mention usage of "http_proxy" variablePeter Hartmann2011-11-211-3/+3
| | | | | | | This is done on systems other than Windows or Mac. Change-Id: I631ea350cb9bc123edc6df33b6f661afa8f0778b Reviewed-by: Arvid Picciani <arvid.picciani@nokia.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
* QNetworkAccessBackend::start() is used although QT_NO_BEARERMANAGEMENT is ↵shkim2011-11-181-2/+0
| | | | | | | | | defined. Merge-request: 2690 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> (cherry picked from commit 4245a82a3eed3ec21b6affc5836af5b2ad2d42e4) Change-Id: I4245a82a3eed3ec21b6affc5836af5b2ad2d42e4
* Improve the testability of QSslOptions.Richard Moore2011-11-172-29/+36
| | | | | | | | | | The handling of QSslOptions is complicated not only by the subject, but also by the fact that some of the openssl directives are negatives. This commit tries to separate the inherent complexity from the complexity of the api by allowing us to test them independently. Change-Id: Ieb9386c69dd9b0b49dc42e26b2878a301f26ded1 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* SSL: fix compilation warning with gcc 4.6.1Peter Hartmann2011-11-161-1/+1
| | | | | | | | "qsslconfiguration.cpp:204:73: warning: suggest parentheses around comparison in operand of ‘|’ [-Wparentheses]" Change-Id: I887ffdf3ef8263c35a8f391b3fc97faee41b7dab Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Fix Qt namespace compilation.Toby Tomkins2011-11-161-0/+2
| | | | | Change-Id: I259b5fde8e4d75d28def8650c4c9208accdf0bbe Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* SSL namespace: rename TlsV1 to TlsV1_0Peter Hartmann2011-11-166-12/+15
| | | | | | | | | | | | This is a source-incompatible change. TlsV1 is ambiguous; what is actually meant is TLS version 1.0. There are also TLS versions 1.1 and 1.2; we might want to add options for these once OpenSSL supports them (apparently they will be with OpenSSL version 1.0.1). Change-Id: I940d020b181b5fa528788ef0c3c47e8ef873796a Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add the ability to do unsafe SSL renegotiation as a fallback.Richard Moore2011-11-155-4/+20
| | | | | | | | | | | This commit adds the ability to perform legacy SSL renegotiation as a fallback via QSsl::SslOptions. This is something that used to work, but has been disabled by default in newer versions of openssl. The need for this has been reported by users (eg. in QTBUG-14983). Change-Id: I5b80f3ffd07e0c5faddc469f6a8f857bac5740f7 Reviewed-by: Corentin Chary <corentin.chary@gmail.com> Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* Always use the hex format for certificate serial numbers.Richard Moore2011-11-151-16/+8
| | | | | | | | | In Qt 4.x the serial number is reported by a mixture of the hex value and the number, The hex is what is used by other tools, and we should do the same. Change-Id: Ia0361d43fb5b920d053c95e932e0c8a012436e5e Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* HTTP: blacklist server for pipeliningPeter Hartmann2011-11-141-0/+1
| | | | | | | | | | | | that server was found out not to support HTTP pipelining. tested manually; for more information see the task. Change-Id: I9120e8be1a9a05f39f99752d6426c92fa3d093f2 (cherry picked from commit ec6d7694f72498d1b156bb0ae8d305e01931f7b2) Reviewed-by: Markus Goetz Task-number: QTBUG-21369 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* network: remove Symbian specific codePeter Hartmann2011-11-1428-3922/+12
| | | | | | | | 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>
* Deprecate QSslCertificate::isValid() replace with isBlacklisted()Richard Moore2011-11-143-14/+30
| | | | | | | | | | | Currently isValid wrongly gives the impression it checks a certificate for validity - it doesn't. It merely checks if the certificate dates are valid and if the certificate is blacklisted. Since it's already easy for users to check the dates, let's just give them access to the ability to check for blacklisting. Change-Id: I25be3bde6a01063034702a9574b28469bf4882cd Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
* QNAM: Fix authentication cache when the password is in the URLOlivier Goffart2011-11-083-3/+8
| | | | | | | | | | | | | | | Two problems: - The signal cacheCredidentials was not connected in the synchronous case while it must be connected. (Regression when the threaded http was merged) - We cannot cache the credidentials when we proceed the url because at that point, we do not know the realm (this basically reverts 9bc5a32b875b812c3a706034c8c27614f86bd138) Task-number: QTBUG-18411 Change-Id: I8ea11fa23db4314c3f17ed06d2d7f9ee934ccdba Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>