summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* QtNetwork: add member-swap to shared classesMarc Mutz2012-07-0628-0/+202
| | | | | | | | Implemented as in other shared classes (e.g. QPen). Change-Id: Ib3d87ff99603e617cc8810489f9f5e9fe054cd2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNativeSocketEngine: remove compile watning on WindowsMartin Petersson2012-07-031-0/+2
| | | | | | | Remove warning of unused variable. Change-Id: Ia361dcb9081cd47c7018f5e75cdb8eb74f5474d4 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* SocketEngine Windows: If not dual stack, use IPv4 for AnyIPProtocolMartin Petersson2012-07-031-0/+3
| | | | | | | | | If the Windows version doesn't support dual stack then we should bind to IPv4. So we should change the socketProtocol to QAbstractSocket::IPv4Protocol as well. Change-Id: I7f9d0bdd861f82d720e347d3fa968198de720d1a Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QSslCertificate::fromPath fix wildcard handlingMartin Petersson2012-07-031-23/+30
| | | | | | | | | | | | | | The reqExp used to handle wildcards in the path was broken. So we always searched the working directory and not the specified path. Autotest where passing because of a hack used for Windows paths where we removed the first two chars in the path string. This fix will not use nativeSeparators thus removing the Windows hack and fix the regExp to match wildcard chars. Task-number: QTBUG-23573 Change-Id: I56fadbb67f25b8ce9c0f17cb6232e0bdb9148b1c Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add null httpReply checks to QHttpThreadDelegateShane Kearns2012-07-031-6/+25
| | | | | | | | | | | | | | | | | If a request is aborted while under load, the abort signal can be queued in front of a signal emitted from the httpReply. The abort slot is deleting the httpReply and setting it to null. So when the queued slot is processed the httpReply is null and caused an MMU fault. Removed qWarning from existing null checks, as these are expected if abort is called with precise timing so that it races with the reply finishing on the socket. Task-number: QTBUG-26245 Change-Id: I0a7e0223fda1bc01d117fe8a993c7f6e43fd72ff Reviewed-by: Jonas Gastal <jgastal@profusion.mobi> Reviewed-by: Richard J. Moore <rich@kde.org>
* Make QtNetwork compile with qconfig smallJeremy Katz2012-07-011-0/+15
| | | | | | | Task-number: QTBUG-24816 Change-Id: I8c7965e4498794db93ee51c8511c9a72071ddce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the QDataStream operator<< for QPair to qdatastream.hThiago Macieira2012-06-282-0/+2
| | | | | | | | | | QPair is small and is no problem to include from qdatastream.h. However, including QDataStream from qpair.h means including QIODevice and QObject too. Change-Id: I344321e9f68438008ec329a165135c3a346c6058 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Removed flags from SSPI calls which prevented the NTLM authentication from ↵Adrian Carpenter2012-06-281-8/+2
| | | | | | | working Change-Id: I87b085442ef301d9d92def0608a8baaa330522e6 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add const & to foreach 'iterators'Albert Astals Cid2012-06-272-3/+3
| | | | | | | Change-Id: I8c0600dfd919f45d14a0011f2da9b9fe0b9a0df3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* QNetworkCookie - ignore unparsable expires attributeShane Kearns2012-06-271-4/+3
| | | | | | | | | | As required by RFC6265, if the date can't be parsed then the attribute should be ignored but not the whole cookie. Task-number: QTBUG-15794 Task-number: QTBUG-16798 Change-Id: I2ed2fbbaf2d00b194995349c24b174032a599703 Reviewed-by: Richard J. Moore <rich@kde.org>
* Ignore empty domain attribute in cookiesShane Kearns2012-06-271-9/+18
| | | | | | | | | As recommended by RFC6265. This fixes the optional-domain0042 test case. Task-number: QTBUG-15794 Change-Id: I6dd459797afcb52fa2a78437f8481f5abc6f3105 Reviewed-by: Richard J. Moore <rich@kde.org>
* Use RFC6265 rules for cookie path & path matchingShane Kearns2012-06-272-8/+25
| | | | | | | | | | | | | | | Url encoding of paths is no longer used. This matches the current release behaviour of Firefox, Chrome and MSIE browsers. RFC6265 does not allow this type of encoding. This fixes remaining path test cases in the IETF test suite. Currently the path0027 test is passed by Firefox but failed by Chrome and MSIE, so there is a potential compatibility issue. However it is a corner case with a malformed cookie. Task-number: QTBUG-15794 Change-Id: I9b02bb5adc32d614f512d314d06f2c60894aa2b0 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie: Use RFC6265 rules for parsing Set-CookieShane Kearns2012-06-271-87/+16
| | | | | | | | | | | | | | The ';' separator takes priority even inside a quoted string. Quotation marks have no special meaning, they are not parsed and regenerated anymore. This means it is not possible to include the ';' character inside a cookie value. Other characters are returned transparently, including [",\] Task-number: QTBUG-15794 Task-number: QTBUG-26002 Task-number: QTBUG-11641 Change-Id: I4eefef5c6ac7753d5a21c226169e264578521fe9 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie - use RFC6265 rules for max-ageShane Kearns2012-06-271-3/+9
| | | | | | | | | | | | | | | | If unparsable, ignore the max-age attribute but process the rest of the cookie normally. If max age <= 0, set expiration time to "earliest representable time" To keep this a safe value for conversions, time_t of 0 is used. This fixes cases 0019 and comma0005 in the test suite. Due to this change, cookies may be sent after they should have expired in case the max-age was malformed. Previously they would have been discarded immediately, which is more likely to break web services. Task-number: QTBUG-15794 Change-Id: I7882af8eb37db156785e4e358ca639e90c94f8d0 Reviewed-by: Richard J. Moore <rich@kde.org>
* QNetworkCookie - ignore unknown attributesShane Kearns2012-06-271-9/+1
| | | | | | | | | | | | RFC6265 clarifies that unknown cookie attributes should be ignored, including the version attribute which was defined by RFC2109 but not used correctly in practice. This fixes case 0008 in the test suite with minimal risk. Task-number: QTBUG-15794 Change-Id: I6f15e8e5e2e5f1ed168fc733a5c84d606a452252 Reviewed-by: Richard J. Moore <rich@kde.org>
* Remove support for multiple cookies in one Set-Cookie header to follow RFC6265.Jocelyn Turcotte2012-06-271-13/+5
| | | | | | | | | | | | This also allows cookie values to contain commas to increase compatibility like most popular browsers do even though the RFC still reserves them for future uses. Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com> Task-number: QTBUG-21456 (cherry-picked from 8ba781b01e900148fec2e9d26485369b3295487f) Change-Id: Ib09ab2411dddf7f99de1c0c31680428b7412fc7e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QAbstractSocket: Enable readNotifier on read from bufferMartin Petersson2012-06-262-0/+10
| | | | | | | | | | | | | | This is needed for the QSslSocket. When we read on that socket we will only read from the QIODevice buffer to get the unencrypted data. So when the readNotifier has been turned off on the plainsocket there is nothing to trigger it to be turned on again. This will add a readData with zero size when we have read everything from the buffer. This is so that we get a call into the socket to check if the readNotifier should be turned on again. Change-Id: I3b63e33de007db823e964480903186eb1b8caac2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: remove double buffering on socketsMartin Petersson2012-06-266-141/+55
| | | | | | | | | Removes the readBuffer from the QAbstractSocket since data is already buffered in the QIODevice. Change-Id: I4e50b791fd2852455e526fa2c07089d4d3f0b2a4 Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix non inheritable socket creation on old windows versionsShane Kearns2012-06-221-16/+21
| | | | | | | | | | | | | | | | | | The documentation is misleading, as using the new API actually causes WSASocket to fail. New behaviour: On windows vista or earlier: skip the new API, use old one On windows 7: try the new API first, if it fails try the old one On windows 8: try the new API only The windows 7 behaviour is because we don't know if the service pack has been installed or not. (And IT departments may have specifically installed/blocked the hotfix) Task-number: QTBUG-26224 Change-Id: I6da47959919caee0cd2697f1ae1fca46aa33c1ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mikhail Vorozhtsov
* Ensure that Proxy-Connection: Keep-Alive is respected for HTTP 1.0Andy Shaw2012-06-221-1/+2
| | | | | | | | | | | | When doing a NTML authentication it would close the connection after the second phase before replying when the reply was a HTTP 1.0 version reply. Since the Proxy-Connection header is set to Keep-Alive in this case we want to ensure we do not close in this siutation. Task-number: QTBUG-26037 Change-Id: Icaaf2277efc0d05a946c52fb42b5191964e2e0fe Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Handle fragmented responses on SOCKS5 control channelShane Kearns2012-06-212-15/+27
| | | | | | | | | | | | Server responses may arrive in more than one packet, though this is rare due to nagle algorithm. Also fixed IPv6 addresses being discarded from server responses, which was caught by the new autotest. Task-number: QTBUG-18564 Change-Id: I32d9e2978037fb3e1fff27b7e618b5da6d222f28 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Change default Content-Type for http POST to match 4.7.4Shane Kearns2012-06-211-2/+5
| | | | | | | | | | | | | | | Qt 4.7.3 sent no Content-Type header by default. This was fixed independently on 4.8.0 and 4.7.4 branches, with different defaults. Since this is often used for web service logins, the 4.7.4 default of x-www-form-urlencoded seems more likely to work. The warning message is left in place, since not specifying the content type is still an application bug. Task-number: QTBUG-23350 Change-Id: I30bf50fd216ee9894d0168e904cea1ed4251ec68 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QNetworkAccessManager: delete the httpThreadMartin Petersson2012-06-202-4/+12
| | | | | | | | | | | | | The httpThread was using deleteLater the finished signal of the thread to call the deleteLater slot. If the QNetworkAccessManager is deleted when the application is closed then then fished is emitted but we never return to the eventloop so the deletion is never done. This will delete the httpThread directly instead of using deleteLater Task-number: QTBUG-25487 Change-Id: I1fdbd4eca01e8bd8b3a98936298e5c78217752b4 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* fix misnomer: qt_module.prf => qt_build_config.prfOswald Buddenhagen2012-06-191-1/+1
| | | | | | qt_module suggests to be congruent to qt_plugin. Change-Id: I629530bcbe2ba6c0adbdc11a275119c8aff0c953
* automatically add QT_BUILD_FOO_LIB to DEFINESOswald Buddenhagen2012-06-191-1/+1
| | | | | Change-Id: I35d9861e48469eb5cc8824e361450684047e6559 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* clean up projects from QPRO_PWD nonsense, etc.Oswald Buddenhagen2012-06-191-3/+1
| | | | | Change-Id: I4c41aedf5bfb37e31ad202cacd2312b0bdb168e2 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* auto-generate QMAKE_PKGCONFIG_REQUIRES and QMAKE_PKGCONFIG_DESCRIPTIONOswald Buddenhagen2012-06-191-2/+0
| | | | | | | less boilerplate, more accuracy Change-Id: I6cc2abd50eafb4901d987c122f10a62ec9ea9da3 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* auto-generate module prisOswald Buddenhagen2012-06-191-2/+0
| | | | | Change-Id: I654428771034221ccf424be34d5d9c7764daf3b4 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* automatically add the version header to HEADERSOswald Buddenhagen2012-06-191-2/+0
| | | | | Change-Id: I7c2e1d852ebdbc5cca7a3a31ab2b4c9ab9faffd9 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* make qt_module_config.prf install the module pri fileOswald Buddenhagen2012-06-191-1/+0
| | | | | | | | | absorb module.prf into qt_installs.prf, as that's where it belongs. add qt_install_module option and automatically set it in qt_module_config. make qt_installs use that option. Change-Id: I860616f3a29a456f7b88ddaffa09375400c8911e Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
* Fix double error setting, which overrode correct value.Jonas M. Gastal2012-06-151-1/+0
| | | | | Change-Id: I3bc992b8b41f305a01b80bca16346e18ac4d7833 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Make qurlinfo private, now that QFtp is private.David Faure2012-06-147-6/+6
| | | | | | Change-Id: I0bb641b397b7087c89009f92d9973e0922dce653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* choke uploadProgress signalsShane Kearns2012-06-143-3/+27
| | | | | | | | | | | | | | | | | | The QNetworkReply::uploadProgress signal is intended for updating UI elements such as a progress bar. Limit the signal emissions to 10 per second to prevent overloading the UI with updates. As with the downloadProgress choke, this is implemented by dropping signals that occur within 100ms of the previous emission. The 100% signal is always emitted (bytesSent == bytesTotal) When the upload size is initially unknown, this behaviour is still provided by the upload device emitting a suitable readProgress signal when EOF is reached. Task-number: QTBUG-20449 Change-Id: I77e03c8a49109106e1c375ee00380293fd326b63 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* choke downloadProgress signalsShane Kearns2012-06-145-7/+40
| | | | | | | | | | | | | | | | | | | The QNetworkReply::downloadProgress signal is intended for updating user interface components (e.g. a progress bar). Limit signal emissions to 10 times per second, with an additional signal just before the finished() signal to provide the 100% progress. For the size of download where a progress bar is necessary, this update frequency seems sufficient. The implementation is done by dropping signals which would be emitted less than 100ms after the previous signal emission. Task-number: QTBUG-20449 Change-Id: I9c2dbe16c70f3270cbf98f3c74cf9d9a3f0ab900 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Partial fix for WebKit compilation on WindowsSimon Hausmann2012-06-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | qdatetime.h uses std::min/max and on Windows windows.h (or some subsequent header file) may under certain circumstances define min/max as macros. The easiest way to prevent the windows header files from doing that is to define NOMINMAX in the place right before windows.h is included. The other way is to define min and max to min/max themselves to prevent windows.h from doing its evil thing. If a user of Qt (WebKit in this case) chooses the approach of defining min/max to themselves and then includes qdatetime.h, then a subsequent inclusion of windows.h doesn't work because qdatetime.h undefines min/max. We should not enforce the type of workaround needed, therefore this patch removes the workaround from qdatetime.h and requires user code that happens to include windows header files before qdatetime.h (seldom case) to choose either workaround. Change-Id: I7347eec7369491a065e894cff557004e069453d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Namespace the bundled zlib symbols, to avoid clash with user zlibaavit2012-06-082-33/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | When Qt is being compiled and is using the bundled zlib, QtCore needs to export the zlib symbols, since zlib is needed in other Qt libraries as well. That gives a danger of a potentially disastrous symbol clash if the user later on links with both Qt and an external zlib (ref. e.g. QTBUG-15071). This commit enables a zlib compilation flag that causes all zlib symbols to be redefined with a prefix. Hence, they will not clash with a standard zlib. A minor drawback is that zlib.h will now have #defines for a few semi-normal identifiers. Hence, a couple of more changes are done: In the private qzip code, the identifer crc32 had to be renamed. QHttpNetworkReplyPrivate needed no change, but as a defensive measure the #include <zlib.h> is moved from the _p.h file to the .cpp file, to avoid surprising compilation errors later in code that include that header. This commit does not in itself solve the issue of how to let Qt libraries outside of qtbase use the same bundled zlib, but it is a prerequisite for that. Change-Id: If84105901a8c90d35009faffe660c85a6bd2fee5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QFactoryInterface from bearer pluginsLars Knoll2012-06-081-10/+1
| | | | | Change-Id: I8d6736e56f34f49041fff409d040634475eb0bf5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark the testSslOption method as introduced in Qt 4.8Laszlo Papp2012-06-071-0/+2
| | | | | | Change-Id: Ibe7cb1ca9cdcedd3f09dd4f865907e3f0fa6aef3 Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QtNetwork: disconnect other channels when network layer detectedMartin Petersson2012-06-063-0/+11
| | | | | | | | | | | | | With Happy Eyeballs we will connect one IPv4 and one IPv6 channel and pick the network layer depending on which connects first. When the first channel is connected we can close the other one. Before this we let the other connection finish connecting and then closed it. This will close the other one as soon as the first one is connected. Change-Id: Ib2ab3f949704fd39dc0584bd31b9bcaf75ce35f7 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add Blackberry path for SSL certificatesNicolas Arnaud-Cormos2012-06-061-0/+1
| | | | | | Change-Id: Ic01e4bddaa6f1fd94f16952e0818f4369c2ec8ab Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Use QPointer instead of QWeakPointer.Stephen Kelly2012-06-051-1/+2
| | | | | | | | The use of QWeakPointer for tracking QObject pointers is to be deprecated. Change-Id: If460ca7f515db77af24030152f4bd56e1a5fae7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: handle raw deflate compressed data in Http.Martin Petersson2012-06-011-1/+20
| | | | | | | | | | | | | | For raw deflate compressed data with no zlib or gzip header we need to call initInflate2 with -MAX_WBITS. The first call to inflate will asume that the data has a header, but if that call fails with a Z_DATA_ERROR we can try once more with changed windowBits incase the data was raw compressed data without a header. Task-number: QTBUG-25513 Change-Id: Ib37c286c6da6d5395581717d0e76a0dbd5df289c Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNetworkReply: Change abort() function into a slotJonathan Liu2012-06-011-1/+1
| | | | | | | | | It is useful for abort() to be a slot for connecting cancel and timeout signals. Change-Id: Ib0146d66fffe3f57b683dfbce0863e378b8c076d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNAM - maintain a weak reference to the QNetworkSessionShane Kearns2012-06-015-43/+61
| | | | | | | | | | | | | | | When handling signals from the session, a pointer is needed. Also the QNetworkReplyImpl needs to access the manager's session. So, the manager should have a strong and weak reference. The strong reference is held during connection establishment. The weak reference is held all the time, though it will become null when the session is destroyed in idle. The non static member function getNetworkSession() is used to create strong references from the weak reference where required. Task-number: ou1cimx#1004278 Change-Id: I4b5b36b1d996b98e659d993969006c61b4440c15 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Track active network replies without qFindChildrenShane Kearns2012-06-012-1/+7
| | | | | | | | | | | | | | | For bearer management to work correctly, we need to know when there are no network replies active. Previously this was implemented using qFindChildren, but that doesn't work when the user reparents QNetworkReply. QtWebkit does this (actually sets parent to 0). Also the qFindChildren implementation was racy if multiple requests were finished in parallel. Again, likely to be triggered by webkit loading page elements. Task-number: QTBUG-15812 Change-Id: I181a9ba6611c7c4b6fffa2d84fe4029d89e8f596 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Put Windows NTLM stuff inside consistent preprocessor directives.Janne Anttila2012-06-012-9/+17
| | | | | | | | | | | | | | | | QNtlmWindowsHandles was placed inside Q_OS_WIN in some places and in other places inside Q_OS_WIN32. It seems that Q_OS_WIN is correct define everywhere. In addition placed "InitSecurityInterfaceW" inside L macro to convert argument to wide characters in WinCE. WinCE GetProcAddress takes LPCWSTR instead of LPCSTR. This fixes the QtNetwork build for WEC7, where Q_OS_WIN32 apparently is not defined. Should it be defined, is another story... Change-Id: Id309d20c46b66139e2cb2e62349067848d8ebb4e Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* QNetworkReplyHttpImpl: code cleanupMartin Petersson2012-05-242-26/+1
| | | | | | | | | | | When the QNetworkAccessHttpBackend was merged into the QNetworkReplyHttpImpl there was some code and comments comming from the backend that was left in the new class. This removes some of these leftovers from the QNetworkAccessHttpBackend. Change-Id: Ifa118160438e2740fb9bf52907066096d8de9ae7 Reviewed-by: Markus Goetz <markus@woboq.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix deprecated API warningShane Kearns2012-05-231-1/+1
| | | | | | | | | | Check for blacklisting in case the application has blacklisted a cert before windows has (currently unlikely as the blacklist is hardcoded in Qt) Don't need to check for time validity because that's already checked by the windows API. Change-Id: I34da5c4a8a0f8851b9b7668fc421a93c360c8588 Reviewed-by: Richard J. Moore <rich@kde.org>
* Fix compile warnings with MSVCShane Kearns2012-05-232-2/+8
| | | | | | | | | | Calling a static function non statically causes an unused variable warning for the optimised away d pointer. sscanf causes an insecure functions warning. (Even though it was used safely in this case) Change-Id: I07700e2155284ef3ebbe7d604ed59b2e61ee7f95 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* QtNetwork: Fix mingw-warnings.Friedemann Kleint2012-05-232-4/+4
| | | | | | | Constructor order, use Q_OS_WIN. Change-Id: Ie45aa9c3aed45437feb66d8ddcfb22530c441435 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>