summaryrefslogtreecommitdiffstats
path: root/src/network
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7Liang Qi2016-03-135-36/+24
|\
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-115-36/+24
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define and undef in src/corelib/tools/qsimd_p.h. This change is also squashed with "Fall back to c++11 standard compiler flag for host builds" which is done by Peter Seiderer. Conflicts: mkspecs/features/default_post.prf src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch src/3rdparty/sqlite/sqlite3.c src/corelib/tools/qsimd_p.h src/gui/kernel/qevent.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/bearer/blackberry/blackberry.pro src/plugins/platforms/cocoa/qcocoasystemsettings.mm src/plugins/platformthemes/gtk2/gtk2.pro src/plugins/styles/bb10style/bb10style.pro src/sql/drivers/sqlite2/qsql_sqlite2.cpp tools/configure/configureapp.cpp Task-number: QTBUG-51644 Done-with: Peter Seiderer <ps.report@gmx.net> Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
| | * Accept LFCRLF to mark end of HTTP HeadersDyami Caliri2016-03-092-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some embedded servers use LF to mark the end of an individual header, but use CRLF to mark the end of all the headers. The GoPro WiFi interface does this, as an example. Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
| | * Use booleans as booleans; don't compare == true to do so !Edward Welbourne2016-03-081-3/+3
| | | | | | | | | | | | | | | Change-Id: Ic900bf000cec52b3ebf0fd0fc61f42252f3200e6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * Purge a verbose no-op.Edward Welbourne2016-03-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | An if with no side-effects in its test and an empty body is a no-op. An else block with nothing but a no-op in it is a no-op. A no-op without even pedagogic value is just a distraction. Change-Id: I224831a325e6b770d0a99d726d96f73da4b8c11f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * Simplified repeated #if-ery and entangled conditionals.Edward Welbourne2016-03-081-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Three checks of the same #if managed to save repetition of (if I felt charitable) three shared lines, compared to combining the three into one, which leaves the code easier to read (and obviates the need for one of the "shared" lines). Split a long line while moving it. Change-Id: I762d10ae1df1224c749206b8eb490bafd7ea4900 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * Duplicate trivial code for clarity on early return.Edward Welbourne2016-03-081-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having a variable in which to store a function's return in two branches of a switch in order to return if either was true saved little relative to just testing the function in each case and returning in situ, which reads more clearly. Change-Id: Ibd95a95721eaa6fc4861b10e723038b96caf269a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| | * consistently put {qt,qml}_{module,plugin} at the end of project filesOswald Buddenhagen2016-03-071-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | this fixes static builds by ensuring that all dependencies are exported. Task-number: QTBUG-51071 Change-Id: Icbce502dcbcb4d4b4d922c42679f44e2cc930bf3 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
| | * QAbstractSocket: fix a possible crash in waitForReadyRead()Alex Trotsenko2016-03-021-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | waitForConnected() could return 'true' even when the socket was disconnected. Change-Id: I99d9c9730f4e9b6c8a54696eb92c24c3ef36d261 Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
* | | QHostInfo: optimize container usageAnton Kudryavtsev2016-03-131-24/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace Java-style iterators with STL-style iterators. Java-style iterators have overhead. Use std::stable_partition with erase() instead of using remove() in a loop, with quadratic complexity. Introduce local template homebrew any_of (analog of std::any_of from C++11) to simplify current code. Also it's needed for following changes in this class. Change-Id: I2b11889ccc7630597c72aa20cdb266ae6ca2471a Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QHttpNetworkConnection: fix spelling in qWarning()Marc Mutz2016-03-121-1/+1
|/ / | | | | | | | | Change-Id: I87dcdc1b81e90d4bac180731fd78d0fea38191b6 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | QtNetwork: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-047-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "" with qWarning("..."). Saves ~850b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: Ib1a087795a03b2a6b432e2c499968df779aaea37 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | QHttpNetworkConnection: fix expensive iteration over QMultiMap::values()Marc Mutz2016-03-041-3/+2
| | | | | | | | | | | | | | | | Just iterate over the container instead, saving one iteration and the creation of a temporary QList. Change-Id: I564e3e83cb247a12c413fc5a9dc17299ae089e30 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QtNetwork: optimize container usageAnton Kudryavtsev2016-03-037-43/+61
| | | | | | | | | | | | | | | | | | Don't perform lookup twice. Just cache iterator or position. Change-Id: I454fd292614dee62167ff248fc3ddec0f79435b0 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QBearerEngine: break out repeated loops as methods.Anton Kudryavtsev2016-03-031-45/+25
| | | | | | | | | | | | | | | | | | | | Three hashes are handled similarly; so extract the loops over them as methods hasUsedConfiguration() and cleanUpConfigurations() to avoid duplicate loop code. Change-Id: I1040724c4fc98caa48913fac339c03e60b04bae2 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QHostAddress: enable (N)RVO in toString() for gccAnton Kudryavtsev2016-03-031-10/+3
| | | | | | | | | | | | Change-Id: I5f8d72742cc4199bfa73df6037b851c58632ff86 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
* | QLocalServer, QLocalSocket: simpler use of startsWith()Anton Kudryavtsev2016-03-032-2/+2
| | | | | | | | | | | | | | | | | | It has a variant accepting QL1S directly, so no need to go via a QString. Change-Id: Ia8f1198ef2af7027bc9f7c2e1dad3a5f78a12eb4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
* | QtNetwork: optimize if-else conditions.Anton Kudryavtsev2016-03-034-15/+14
| | | | | | | | | | | | | | | | De-duplicate calls by caching results. Reorder conditions: call cheap methods first. Change-Id: I27715b935247c6c21bd02f9cc40655d3f9371264 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Integrate network sockets into the multichannel infrastructureAlex Trotsenko2016-03-0116-19/+123
| | | | | | | | | | | | | | Change-Id: I96974a7460c29b46cae8a28aadb3e50cdcdb7beb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
* | Add We-mean-it comment to qnetworkdatagram_p.h.Friedemann Kleint2016-02-251-0/+11
| | | | | | | | | | | | | | | | Fix warning: WARNING: qtbase/src/network/kernel/qnetworkdatagram_p.h does not have the "We mean it." warning Change-Id: I65fc2dc9129b194b08865e3486fae4d0cad3f3d3 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QtNetwork: don't use Boyer-Moore for single-character needlesMarc Mutz2016-02-242-11/+4
| | | | | | | | | | | | | | | | | | | | | | Using Boyer-Moore for single-character search strings makes no sense since there can be no skipping beyond the normal sequential search anyway. So, port to QByteArray::indexOf(char). Change-Id: I848e2ceea5ceafd0ebae402798b410f682348a75 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-183-15/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * QtNetwork: Silence Clang on Windows.Friedemann Kleint2016-02-172-14/+1
| | | | | | | | | | | | | | | | | | Remove dead code and fix override. Task-number: QTBUG-50804 Change-Id: I9cc28507e549d56a1f15fcc54bb6f7465beef644 Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * Fix QT_DEPRECATED_SINCE usageJędrzej Nowacki2016-02-021-1/+1
| | | | | | | | | | | | | | | | The deprecation was introduced in 5.6 Change-Id: Ief6b749b40ec75c3c9f904caed8447bfb5ef5439 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Merge "Merge dev into 5.7" into refs/staging/5.7Oswald Buddenhagen2016-02-173-19/+21
|\ \
| * | QHttpNetworkConnectionPrivate: de-duplicate calls in if-else chainsAnton Kudryavtsev2016-02-151-14/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and loops. Every QNetworkConfiguration::bearerType() call produces lock/unlock of mutex. Fix: cache result. Every QHttpNetworkRequest::contentLength() call contains internal loop. Fix: cache result. Also cache results of QNonContiguousByteDevice::size() and QHostAddress::protocol(). Change-Id: I01124648b1972f480905433d9b3551c2246e1bde Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | Use QVector instead of QList for sizeof(T) > sizeof(void*)Sérgio Martins2016-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | caught with static analyzer which only warns for trivial cases: - Container must be local - Container isn't passed to any function, assigned to another container or assigned to. Change-Id: I3f3aa73c128a56f067fa8745990977445a495ac4 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| * | Use QFlags::setFlag where prudent in qtbaseAndre Somers2016-02-121-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFlags::setFlag is most useful to replace explicit constructs like if (condition) { someFlags |= TheConditionFlag; } else { someFlags &= ~TheConditionFlag; } with someFlags.setFlag(TheConditionFlag, condition); Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QSslSocket (OpenSSL): replace QList<QPair> by QVector<Struct>Marc Mutz2016-02-172-25/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A QList<QPair<int,int>> is one of the most dangerous ones, because it fundamentally changes memory layout, and therefore performance and invariants, when going from 32-bit platforms (array list) to 64-bit (vector-like). Port to QVector instead, which has a consistent design across all platforms. Also port from QPair to a simple struct { code, depth }, because member names such as 'first' and 'second' have no semantic value and make code using them very hard to understand. Change-Id: I86c95d78dbb2e82ec222d6eae8ba11568e3ff0af Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | QSslSocket (OpenSSL): use QMutexLockerMarc Mutz2016-02-171-2/+2
|/ / | | | | | | | | | | | | ... instead of naked QMutex::(un)lock(). Change-Id: I9927e60286231bfc254d99cc88c39301b31df336 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Optimize QSslSocketPrivate::isMatchingHostname()Marc Mutz2016-02-081-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | - Lowercase 'peerName' only once instead of each time though the loop - Use C++11 range-for instead of Q_FOREACH - Use QMap::equal_range instead of values(Key), saving the creation of a QList. Change-Id: I1229f62d706d1478960b08bb63ee9fb894364f87 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Richard J. Moore <rich@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QNonContiguousByteDevice: mark atEnd(), size(), pos() methods as const.Anton Kudryavtsev2016-02-081-3/+3
| | | | | | | | | | | | | | These methods do not modify the object. Change-Id: I9ab9a17fa24f5a608943ec263913df14218214a8 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Drop most "#ifndef QT_NO_LIBRARY"Ulf Hermann2016-02-081-4/+0
| | | | | | | | | | | | | | | | | | As we can load plugins without QLibrary now, we don't have to #ifdef out the code that does so anymore. Change-Id: I1dc20216830a882dbd5a1b431183407e6b19c837 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QLocalSocket: Use poll instead of select on UnixLouai Al-Khanji2016-02-041-23/+12
| | | | | | | | | | Change-Id: I5399623d284ccd804bd1638da143ccdb973af9e2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Clean up new poll code slightlyLouai Al-Khanji2016-02-042-26/+4
| | | | | | | | | | Change-Id: I046126ff69a77a50e79efb1b6ebb0fffef67ac8e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Simplify QAbstractSocket::readData()Alex Trotsenko2016-02-031-22/+8
| | | | | | | | | | | | | | | | It needed refactoring after prior changes (bf6897edb0, 1ce203d05a, 48a4a67e8d). Change-Id: I06ee3f4f70db2a71acfc8e9c1da5b4ad7524179d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Unix platforms: Use qt_safe_poll in QLocalServerLouai Al-Khanji2016-02-031-13/+28
| | | | | | | | | | Change-Id: If9f0c1a0089b16729c20c0e05feca58a514d3e25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Unix platforms: Use poll in native socket engine instead of selectLouai Al-Khanji2016-02-031-29/+29
| | | | | | | | | | Change-Id: I10fde9f446ee17c921ce9cf356a27daac396321d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-5/+6
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * QNetworkProxyFactory: don't re-call QUrl::scheme() in if-else chain.Anton Kudryavtsev2016-01-291-5/+6
| | | | | | | | | | | | | | | | ... Just cache it. Change-Id: Iae70e09233b237d904ab100f46f8dc7ab9ac8e04 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Don't use QStringLiteral in comparisonsAnton Kudryavtsev2016-01-281-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For QLatin1String, operator== is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I761b2b26ab5b416bc695f524a9ee607dacf0a7b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QtBase: avoid uses of Java-style iterators [QHash, QMap]Marc Mutz2016-02-021-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Java-style iterators are slower than STL-style ones, so they should not be used in library code. Replaced them with C++11 range-for, STL iterators or, in one case, qDeleteAll(). In one case, avoid a double hash lookup by using erase(it) instead of remove(it.key()), which we can now do without detaching, due to the new erase() taking const_iterator. Change-Id: I96174657fed70f76120b2c9d8190b4e70d5d8179 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | QRingBuffer: add append(const char *, qint64) functionAlex Trotsenko2016-02-014-14/+5
| | | | | | | | | | | | | | This allows to remove a code duplication in several places. Change-Id: I49f56e951682dbd2968923654a12cba5199a2502 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Fix QSocketEngineBackend::nativeBytesAvaible for UDP socketsTimur Pocheptsov2016-01-291-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On OS X ioctl(... FIONREAD) on UDP socket returns more than expected: "SO_NREAD returns the amount of data in the input buffer that is available to be received For datagram oriented sockets, SO_NREAD returns the size of the first packet -- this dif- fers from the ioctl() command FIONREAD that returns the total amount of data available." (man getsockopt). On OS X bytesAvailable for UDP socket seems to include some headers also: for a datagram of size 1 - bytesAvailable == 17, 2 - bytesAvailable == 18 etc. Found in a broken tst_qudpsocket test. Change-Id: I88be827c66208835ed10b010f13d9dc70576fea4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QNetworkHeadersPrivate: use erase and std::remove_if with QListAnton Kudryavtsev2016-01-291-7/+8
| | | | | | | | | | | | | | ... instead of using erase in a loop, with quadratic complexity. Change-Id: I91053ddb58639615e8864e5be20861e7cceb815e Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QHttpNetworkHeaderPrivate: use erase and std::remove_if with QListAnton Kudryavtsev2016-01-281-7/+8
| | | | | | | | | | | | | | ... instead of using erase in a loop, with quadratic complexity. Change-Id: I9527923dcfc3201776a59de53dd5c03ca4d80063 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/devLiang Qi2016-01-262-19/+19
|\ \
| * | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-262-19/+19
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/dbus/qdbusconnection_p.h src/dbus/qdbusintegrator.cpp src/dbus/qdbusintegrator_p.h tests/auto/corelib/io/qdir/qdir.pro tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
| | * winrt: Fix potential crash in readDatagramMaurice Kalinowski2016-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The native socket engine used strcpy for WinRT, which tries to copy terminating null character. The QSocketNotifier::async_readDatagramSlot autotest uses a buffer of size 1, which causes readDatagram to overwrite the buffer on the stack. Hence use memcpy instead to protect from additional copies beyond barriers. Note that we cannot use qstrcpy as that does a buf[size-1] = '\0' at the end, which would remove content for a buf size of 1. Change-Id: I20baf9e63646cd28c1c954a20b8ae9c7d5873c31 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
| | * QNetworkInterface: don't add a QNetworkAddressEntry if no IP is knownThiago Macieira2016-01-211-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If SIOCGIFADDR fails, then don't bother trying to get the broadcast address or netmask, and especially don't add the empty QNetworkAddressEntry to the interface. This can happen on interfaces that have no IP address assigned (for example, inactive interfaces). Change-Id: I8de47ed6c7be4847b99bffff141c326d94ecca78 Reviewed-by: Richard J. Moore <rich@kde.org>