From c63c3f398738434dc0fb10723de3a083613b3b71 Mon Sep 17 00:00:00 2001 From: Ben de Groot Date: Thu, 7 May 2015 08:49:40 +0000 Subject: [PATCH] Revbump applying upstream QNAM-corruptions-fix.patch (bug #548622) Package-Manager: portage-2.2.18/cvs/Linux x86_64 Manifest-Sign-Key: 0x4FDF9CFD2FAC514E! --- dev-qt/qtcore/ChangeLog | 8 +- dev-qt/qtcore/Manifest | 36 +- .../qtcore-4.8.6-QNAM-corruptions-fix.patch | 431 ++++++++++++++++++ dev-qt/qtcore/qtcore-4.8.6-r2.ebuild | 92 ++++ 4 files changed, 549 insertions(+), 18 deletions(-) create mode 100644 dev-qt/qtcore/files/qtcore-4.8.6-QNAM-corruptions-fix.patch create mode 100644 dev-qt/qtcore/qtcore-4.8.6-r2.ebuild diff --git a/dev-qt/qtcore/ChangeLog b/dev-qt/qtcore/ChangeLog index 3a229d4075d8..f596de2c4949 100644 --- a/dev-qt/qtcore/ChangeLog +++ b/dev-qt/qtcore/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-qt/qtcore # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-qt/qtcore/ChangeLog,v 1.69 2015/04/15 03:43:10 dlan Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-qt/qtcore/ChangeLog,v 1.70 2015/05/07 08:49:35 yngwin Exp $ + +*qtcore-4.8.6-r2 (07 May 2015) + + 07 May 2015; Ben de Groot + +files/qtcore-4.8.6-QNAM-corruptions-fix.patch, +qtcore-4.8.6-r2.ebuild: + Revbump applying upstream QNAM-corruptions-fix.patch (bug #548622) 15 Apr 2015; Yixun Lan qtcore-4.8.6-r1.ebuild: keyword arm64, tested on cortex-a53 hardware diff --git a/dev-qt/qtcore/Manifest b/dev-qt/qtcore/Manifest index 895ae31fe9ef..0e6f5add1199 100644 --- a/dev-qt/qtcore/Manifest +++ b/dev-qt/qtcore/Manifest @@ -6,30 +6,32 @@ AUX CVE-2013-4549-02-fully-expand-entities.patch 6117 SHA256 848dbcd78c2ae0a3f6a AUX qtcore-4.8.5-honor-ExcludeSocketNotifiers-in-glib-event-loop.patch 3410 SHA256 9dbb9be4dfefc00711058b99fe2425bb43c811a1b36a6f046336e13c666d40ea SHA512 6770959ba01756d6a3fa9e03edd5f6c1df0d8625f4add65f7fef55a93b7b52c555a0ce749984938fb7ab905c2e0875cec0cb5d07f45c1b447fbc9e2d0ec678bb WHIRLPOOL d06e33e4d6545b99d930212f6ad767a6c59cb241cb0b28fe3401853700c26c9fd9a5dc0eb5cfaef62ed8f7874eccf906c7c39c469c6725e9db3836c8982422d8 AUX qtcore-4.8.5-moc-boost-lexical-cast.patch 584 SHA256 dadd3eab516ee26f1c19f17dbcb7be46e7c9efba49924fa1d53cc0176491736a SHA512 ed2cc3d36ac8576cee42d1586b99913ce060a47e72c82890e7b5fe4fc500e857693f2348f4446ce7dfbd1bbdf6e51b99b57f2fc09d6c15f9075f10c4b5459fa6 WHIRLPOOL d4ee64605ad9dacd371519a9c08582c25ea891480c79795822cfe74e6bafb332d558dca5d024c6f369e3674fde5a89a15a7d79042093295ac9d0a0d516493583 AUX qtcore-4.8.5-qeventdispatcher-recursive.patch 4017 SHA256 5db36cbb0686b8a503941779c821febc4a0330dc260e51d603f7aa1e4d8860ad SHA512 bd63961bcb695beebe8686142b84bff7702db4d85d737f5c2da927252b931700d03602f80048223cbbb05d85a5ddb9cb818321d756577f84843690b318f0c413 WHIRLPOOL f981bf3c3d1a62b486788433cabb2880b7f361ccdf99e502fb595608195168d72ba14018c93273f2726c60bae61a44cba3244026009823e832109a1f7418e773 +AUX qtcore-4.8.6-QNAM-corruptions-fix.patch 17586 SHA256 5309c0f1ed0fc54799537b6d0a51b9682f52b4b40cc76e6fa71afc7273120e40 SHA512 4367974513b230d0395d0d0ebff5007255c257126309b614c37e8297981b833b397792fe9dede1960e0027a87d3fbc5eb252253a7ed73f4f9383531ea39cc874 WHIRLPOOL 8eded4f95d00f2ce572cf1956745d5a06e07f54a6ed6e67578914c0d2c9be63994cbf9177212d25c3c2678bf7328b2364b5977ebb8e8d7b8e4ad79009be6a7ae DIST qt-everywhere-opensource-src-4.8.5.tar.gz 241491467 SHA256 eb728f8268831dc4373be6403b7dd5d5dde03c169ad6882f9a8cb560df6aa138 SHA512 47118d1aa30c59a1eb74e805023cd060edcb35bb0944fe6651889254b75acbd4b83700ba92a9bc215663474d26330cb44f084098c380fac9270742659e5864eb WHIRLPOOL a18f47fd91b522d1543e415aff4f5056202e0cab03da9cfcae9fe2d4118cb1dd1d5fd6a5e2edb9c1e4a68563188d44440e234d268d9c0aef6e3ca3f0988dd357 DIST qt-everywhere-opensource-src-4.8.6.tar.gz 241623667 SHA256 8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c SHA512 c2d07c3cf9d687cb9b93e337c89df3f0055bd02bc8aa5ecd55d3ffb238b31a4308aeabc3c51a4f94ac76a1b00796f047513d02e427ed93ae8dd99f836fff7692 WHIRLPOOL 473566814a77237dbdd37a47980c1085f6cf39599c4d6b0120959fe80dadf65c4eaafd5f528dd86cea8815562faa204bedfe3b766c2ca4f2d2c99efc21dbca84 DIST qtbase-opensource-src-5.4.1.tar.xz 46132220 SHA256 8574a593830959c0f7e5430fe77a43832ea7f5299e14a397a74576b3df7fb1b7 SHA512 75d2c16bc47e6403e15c4094f50757157960cff4434de29f199b015795ba772b62125f01c09aceb2a06f8dfcfc4df8e35330259c76959239f276e2f5bd5221b5 WHIRLPOOL 48d9a583ba9d0bbfffdbfeaa2412e77a0bf4011e7bba525129ba4572faa6a55713a89cb00f4ed7f24e6782e3f7b8b48cb192e2c082b7dcb3c35a85109f2eb340 EBUILD qtcore-4.8.5-r2.ebuild 5207 SHA256 166ffd4d2357025ce9eef8ca0db78184915219b8f3e2e19b8543ef35a7d20094 SHA512 3434d8243745241b55a10ea92a7c24012c1062584fd441d1805119d673c2a55d38caceb65442e168b4a4f0ca93982bf8b052c79ce0db1fbc75ce28d7e3f2c188 WHIRLPOOL 5ccf583d46b52e221d867eea97284d673fb786510a8f73f2cfa9050884a158958e9563895ed125e49492cb5e3f0593d32b2e088e9b15b8d2aaaeddcd333f2310 EBUILD qtcore-4.8.6-r1.ebuild 2895 SHA256 40c68715d60c1746bb170843fe9d6080a3f7ad99b0adbd6e640d168249994a76 SHA512 c3995417504adcc5bab5e2dcbc7c42e096f3f45068492acffeec6a22376306ee30ece16e9bc542a3f82b9e64488b4ede4c566c86218f6d89e94b2bf6869465d2 WHIRLPOOL 94ad51271105a24e4458f92cffd732401661e68ffad3318ffc58074217a766abd7cb2d62a0f433059622ef9dbe942c5feadc1a2a3ffe263784715b56462d1392 +EBUILD qtcore-4.8.6-r2.ebuild 2964 SHA256 02027f933e637bb06c0956fb679e270fcc1f5287476a0832ac53d587630878fc SHA512 65d696769233aefc46d30c1f3b5899ad9b72d0cce35e8da01c889b495a24725f0c9d3654d8bbcb6d6b80a14f2bcdbe7f4fb6208517ece45fee3dd7a23a2845d3 WHIRLPOOL 700e1f88a9dcb1b762407886da37c73fb4bf75c7d7f1c50a255a3bb55c82c7eb0590cdec6cfab6bc0e82b3883247867012902868b678660b72ee0ed62820cd06 EBUILD qtcore-5.4.1.ebuild 836 SHA256 92c37024a7f84e3459ece24f264e6dd97b8aa34fbb51d2a78c0db94b8b589fe1 SHA512 ae034f3adb1710338abb70583397fdac310185e4d02e0c1c253cc2b7968e674abd7b8f106b626fb26b01221c8a60e33dac249077f5a2b57dbede977f68a7befa WHIRLPOOL c74bae7241441a67763c0b9ea3bfb08be27fb198bf36c463fff4769542006ed12406e825bf677e7e9b9089965c123a4773f1e951ea683d97eb6a78864d26ba53 -MISC ChangeLog 38010 SHA256 158afcc25109dc67ae4fde7febfe60a13af5b7cb7e0838da2ff882f0f0892cfc SHA512 53896079d723ae1ff120163a7647b32421f465087b423d85ef811a9317238b3298d0a9ce7aad4f41cc4517be1bd576e2fed39e036350ffdfc628a04af195e5a0 WHIRLPOOL fb1bdeb1d85816c4411f928250945a7bcbdc49e56037d40c79c3be326db4d4f6fbb9414672e07047eb1cd091cc4553da52ceffaba15d2687e9e7742ec2431103 +MISC ChangeLog 38237 SHA256 66097970e419b43db02df88c2c635105421e484460f92e1bdfc56b7c9237f71c SHA512 07d81f3bcc33e7e140a8555c946bae7ca6d61cd471cff1059184b9260a87a8dd3314164d15e6890073f599beb4f4bb4ba539380dc6810274704bdfd6029bc8bc WHIRLPOOL e548e9d2e5520f59eba29c94fc364be0216256d0902746a92e910e73b7954e538b42edb6dab4eae6968c2a0c6505ef03db0c4f1f3ac1ef6986eb92f995c2afef MISC metadata.xml 642 SHA256 7fc084d5cbde663884ed35e9733591c8b33c30bc0baf091960e9bf791a49840e SHA512 394414c48c95a7eab1cdefbd8dab7df4049e18daf1d8f5c1cf9dd13c6d79fbaffa5f30d83358cab8de81ef715bf6826095a7e3b3a40e0ac4556a662a8f292093 WHIRLPOOL bda8ef8538520b6e4bdc25adb88ce73225dffa2139f0c3dce768bc924167986a0fc137173003cb923a5ab3f52a44f67cf668f0c85c0c7858f5a9e1b16f9586ef -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0 +Version: GnuPG v2.1 -iQJ8BAEBCABmBQJVLkzaXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w -ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCNUJBQjhDOUMzMUI3MTE1NjcwMjIzREMz -MUFBRUE0NzU5NERCQkVEAAoJEDGq6kdZTbvtnH4QAI5FNz3jcAO4qoLmR3F/UB2h -Zjs5sXegWLCbSyapvqAnuAYilCtFiqx0K4VBY5nLeorIO4ByK8SPcU7HqZ8qRYhU -6XA5eYei6/zQiaHoy+FGiXrV2bbvSRsKIQ06bm2QwJWPLYCoGtuMjnsXe7wlrkc+ -4XI7BKImzdjZuigfbr/c/PkneM2ujfgykxRQQKpgTKAM1g6sk7FNHK0aBXQpmDaP -aR4pdcZDMXYBboML1zFWg7VTsR80lAs4fQtfM19D2GlfgHxrXcP/v8YN46H2oiHG -beXkJeDGf+fYxi1k1zKNg9ZSiAR4Q5sqlYOHyawPvWRJQmnUGRaAZob8E5RqJ4ss -iC6+p/XNQDDRLmFb9spIDe6nEFHIHS+Z3TjPRxuG6u6s99oxJTLbRZ2FcfOWCMju -rppzJYyrb9uZgPSHEvD9y9otVbMAD62MR9/QKDkXBsABA6VIRRQwoRcEVEqV5kxi -4jfv+qL0Y/wJTYs1oP8QTEgqC2iltBgl8TaFswMbsGqOVpGoKYxnLRJSt/kHTI4W -9QUBP3mB0o+Wx6LYm8WU8zNXPOEit04SlPFqFZkZyZYNvN9cCsF4XolclPalRz4r -OnZgyK5USGcsAJqyyKUUkUSgz26A7omxvcvFHpyXW80XqIviSE44xucHGV8u0iKw -CBQBq3WXsqcN80Y7P6Iw -=fFbQ +iQJ8BAEBCABmBQJVSycjXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w +ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ5MTlDREQ0NUU5Mjc4RkU2RjJDNTAyNzU0 +RkRGOUNGRDJGQUM1MTRFAAoJEE/fnP0vrFFOSAYQALUc0HbffGPb+THCOAFNtrjq +GYQfHn6WcZEU7rJVyhEFgCB4ikSyJKscXUT7avT9QF0ivIXMV9lhzQNyf7heNQ6p +YlCEn8TwBK8qldfmcqvUDh+nPz7kwsWf011aO6ceZ4RWCA/drMCsf3G92C21Kh8c +PJantk4QGVMJ1BMpOtQFAfTvy3ZRUUWOJo3++WjueVktIUOu7NeuP8SF0FO3N4NV +TGkQzrAmG+vBtNZdsKc7OQLjJbY9XNu04WVuVWUEP1aN+94vAAVOCt7LygFMtFS8 +zw9hRbtKEGYKH1naAbx+BRaoNKjZeCCw0+KdZUb/QR8ysCsIViehPYjotBXHhY27 +oTRAQIHAcl1HvYncyrv2Trjae01pXjkjd0lr0LSvN13WgDKHIo8UhuKOtKS0Uwo9 +PX+mlFTM9+BEqg3hKwg8k/LNDo8B7yXHFwSLkc60pzkGzujoFOddr6xgPRkM5nL2 +8Nba6WMnOVPNcxc6oDBZDnHA+bVemyz/7wMLFmV5R5qmjzcSHR9wo/4MALQkssme +P9IWtrP9BlflK+hUXfUDRrJT3vN8YO5iD96hUVIou1aczbg7BxSkbhuvp4pXYg0w +uo+fH0bLdMuwu5DTcGYAnR7weliFtNPp7gljFXf4o8ex+tptWDRM5Hza/YWiuN+v +GUq89pT626tv9Qpw/mF2 +=Cqvs -----END PGP SIGNATURE----- diff --git a/dev-qt/qtcore/files/qtcore-4.8.6-QNAM-corruptions-fix.patch b/dev-qt/qtcore/files/qtcore-4.8.6-QNAM-corruptions-fix.patch new file mode 100644 index 000000000000..1d83caa3a260 --- /dev/null +++ b/dev-qt/qtcore/files/qtcore-4.8.6-QNAM-corruptions-fix.patch @@ -0,0 +1,431 @@ +From fa81aa6d027049e855b76f5408586a288f160575 Mon Sep 17 00:00:00 2001 +From: Markus Goetz +Date: Tue, 28 Apr 2015 11:57:36 +0200 +Subject: QNAM: Fix upload corruptions when server closes connection + +This patch fixes several upload corruptions if the server closes the connection +while/before we send data into it. They happen inside multiple places in the HTTP +layer and are explained in the comments. +Corruptions are: +* The upload byte device has an in-flight signal with pending upload data, if +it gets reset (because server closes the connection) then the re-send of the +request was sometimes taking this stale in-flight pending upload data. +* Because some signals were DirectConnection and some were QueuedConnection, there +was a chance that a direct signal overtakes a queued signal. The state machine +then sent data down the socket which was buffered there (and sent later) although +it did not match the current state of the state machine when it was actually sent. +* A socket was seen as being able to have requests sent even though it was not +encrypted yet. This relates to the previous corruption where data is stored inside +the socket's buffer and then sent later. + +The included auto test produces all fixed corruptions, I detected no regressions +via the other tests. +This code also adds a bit of sanity checking to protect from possible further +problems. + +[ChangeLog][QtNetwork] Fix HTTP(s) upload corruption when server closes connection + +(cherry picked from commit qtbase/cff39fba10ffc10ee4dcfdc66ff6528eb26462d3) +Change-Id: I9793297be6cf3edfb75b65ba03b65f7a133ef194 +Reviewed-by: Richard J. Moore +--- + src/corelib/io/qnoncontiguousbytedevice.cpp | 19 +++ + src/corelib/io/qnoncontiguousbytedevice_p.h | 4 + + .../access/qhttpnetworkconnectionchannel.cpp | 47 +++++- + src/network/access/qhttpthreaddelegate_p.h | 36 ++++- + src/network/access/qnetworkaccesshttpbackend.cpp | 24 ++- + src/network/access/qnetworkaccesshttpbackend_p.h | 5 +- + tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 174 ++++++++++++++++++++- + 7 files changed, 280 insertions(+), 29 deletions(-) + +diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp +index bf58eee..1a0591e 100644 +--- a/src/corelib/io/qnoncontiguousbytedevice.cpp ++++ b/src/corelib/io/qnoncontiguousbytedevice.cpp +@@ -245,6 +245,12 @@ qint64 QNonContiguousByteDeviceByteArrayImpl::size() + return byteArray->size(); + } + ++qint64 QNonContiguousByteDeviceByteArrayImpl::pos() ++{ ++ return currentPosition; ++} ++ ++ + QNonContiguousByteDeviceRingBufferImpl::QNonContiguousByteDeviceRingBufferImpl(QSharedPointer rb) + : QNonContiguousByteDevice(), currentPosition(0) + { +@@ -296,6 +302,11 @@ qint64 QNonContiguousByteDeviceRingBufferImpl::size() + return ringBuffer->size(); + } + ++qint64 QNonContiguousByteDeviceRingBufferImpl::pos() ++{ ++ return currentPosition; ++} ++ + QNonContiguousByteDeviceIoDeviceImpl::QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d) + : QNonContiguousByteDevice(), + currentReadBuffer(0), currentReadBufferSize(16*1024), +@@ -415,6 +426,14 @@ qint64 QNonContiguousByteDeviceIoDeviceImpl::size() + return device->size() - initialPosition; + } + ++qint64 QNonContiguousByteDeviceIoDeviceImpl::pos() ++{ ++ if (device->isSequential()) ++ return -1; ++ ++ return device->pos(); ++} ++ + QByteDeviceWrappingIoDevice::QByteDeviceWrappingIoDevice(QNonContiguousByteDevice *bd) : QIODevice((QObject*)0) + { + byteDevice = bd; +diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h +index b6966eb..d1a99a1 100644 +--- a/src/corelib/io/qnoncontiguousbytedevice_p.h ++++ b/src/corelib/io/qnoncontiguousbytedevice_p.h +@@ -69,6 +69,7 @@ public: + virtual const char* readPointer(qint64 maximumLength, qint64 &len) = 0; + virtual bool advanceReadPointer(qint64 amount) = 0; + virtual bool atEnd() = 0; ++ virtual qint64 pos() { return -1; } + virtual bool reset() = 0; + void disableReset(); + bool isResetDisabled() { return resetDisabled; } +@@ -108,6 +109,7 @@ public: + bool atEnd(); + bool reset(); + qint64 size(); ++ qint64 pos(); + protected: + QByteArray* byteArray; + qint64 currentPosition; +@@ -123,6 +125,7 @@ public: + bool atEnd(); + bool reset(); + qint64 size(); ++ qint64 pos(); + protected: + QSharedPointer ringBuffer; + qint64 currentPosition; +@@ -140,6 +143,7 @@ public: + bool atEnd(); + bool reset(); + qint64 size(); ++ qint64 pos(); + protected: + QIODevice* device; + QByteArray* currentReadBuffer; +diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp +index 550e090..db2f712 100644 +--- a/src/network/access/qhttpnetworkconnectionchannel.cpp ++++ b/src/network/access/qhttpnetworkconnectionchannel.cpp +@@ -107,15 +107,19 @@ void QHttpNetworkConnectionChannel::init() + socket->setProxy(QNetworkProxy::NoProxy); + #endif + ++ // We want all signals (except the interactive ones) be connected as QueuedConnection ++ // because else we're falling into cases where we recurse back into the socket code ++ // and mess up the state. Always going to the event loop (and expecting that when reading/writing) ++ // is safer. + QObject::connect(socket, SIGNAL(bytesWritten(qint64)), + this, SLOT(_q_bytesWritten(qint64)), +- Qt::DirectConnection); ++ Qt::QueuedConnection); + QObject::connect(socket, SIGNAL(connected()), + this, SLOT(_q_connected()), +- Qt::DirectConnection); ++ Qt::QueuedConnection); + QObject::connect(socket, SIGNAL(readyRead()), + this, SLOT(_q_readyRead()), +- Qt::DirectConnection); ++ Qt::QueuedConnection); + + // The disconnected() and error() signals may already come + // while calling connectToHost(). +@@ -144,13 +148,13 @@ void QHttpNetworkConnectionChannel::init() + // won't be a sslSocket if encrypt is false + QObject::connect(sslSocket, SIGNAL(encrypted()), + this, SLOT(_q_encrypted()), +- Qt::DirectConnection); ++ Qt::QueuedConnection); + QObject::connect(sslSocket, SIGNAL(sslErrors(QList)), + this, SLOT(_q_sslErrors(QList)), + Qt::DirectConnection); + QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)), + this, SLOT(_q_encryptedBytesWritten(qint64)), +- Qt::DirectConnection); ++ Qt::QueuedConnection); + } + #endif + } +@@ -163,7 +167,8 @@ void QHttpNetworkConnectionChannel::close() + else + state = QHttpNetworkConnectionChannel::ClosingState; + +- socket->close(); ++ if (socket) ++ socket->close(); + } + + +@@ -280,6 +285,14 @@ bool QHttpNetworkConnectionChannel::sendRequest() + // nothing to read currently, break the loop + break; + } else { ++ if (written != uploadByteDevice->pos()) { ++ // Sanity check. This was useful in tracking down an upload corruption. ++ qWarning() << "QHttpProtocolHandler: Internal error in sendRequest. Expected to write at position" << written << "but read device is at" << uploadByteDevice->pos(); ++ Q_ASSERT(written == uploadByteDevice->pos()); ++ connection->d_func()->emitReplyError(socket, reply, QNetworkReply::ProtocolFailure); ++ return false; ++ } ++ + qint64 currentWriteSize = socket->write(readPointer, currentReadSize); + if (currentWriteSize == -1 || currentWriteSize != currentReadSize) { + // socket broke down +@@ -639,6 +652,14 @@ bool QHttpNetworkConnectionChannel::ensureConnection() + } + return false; + } ++ ++ // This code path for ConnectedState ++ if (pendingEncrypt) { ++ // Let's only be really connected when we have received the encrypted() signal. Else the state machine seems to mess up ++ // and corrupt the things sent to the server. ++ return false; ++ } ++ + return true; + } + +@@ -980,6 +1001,13 @@ void QHttpNetworkConnectionChannel::_q_readyRead() + void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes) + { + Q_UNUSED(bytes); ++ ++ if (ssl) { ++ // In the SSL case we want to send data from encryptedBytesWritten signal since that one ++ // is the one going down to the actual network, not only into some SSL buffer. ++ return; ++ } ++ + // bytes have been written to the socket. write even more of them :) + if (isSocketWriting()) + sendRequest(); +@@ -1029,7 +1057,7 @@ void QHttpNetworkConnectionChannel::_q_connected() + + // ### FIXME: if the server closes the connection unexpectedly, we shouldn't send the same broken request again! + //channels[i].reconnectAttempts = 2; +- if (!pendingEncrypt) { ++ if (!pendingEncrypt && !ssl) { // FIXME: Didn't work properly with pendingEncrypt only, we should refactor this into an EncrypingState + state = QHttpNetworkConnectionChannel::IdleState; + if (!reply) + connection->d_func()->dequeueRequest(socket); +@@ -1157,7 +1185,10 @@ void QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired(const QNetwor + + void QHttpNetworkConnectionChannel::_q_uploadDataReadyRead() + { +- sendRequest(); ++ if (reply && state == QHttpNetworkConnectionChannel::WritingState) { ++ // There might be timing issues, make sure to only send upload data if really in that state ++ sendRequest(); ++ } + } + + #ifndef QT_NO_OPENSSL +diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h +index 7648325..9dd0deb 100644 +--- a/src/network/access/qhttpthreaddelegate_p.h ++++ b/src/network/access/qhttpthreaddelegate_p.h +@@ -190,6 +190,7 @@ protected: + QByteArray m_dataArray; + bool m_atEnd; + qint64 m_size; ++ qint64 m_pos; // to match calls of haveDataSlot with the expected position + public: + QNonContiguousByteDeviceThreadForwardImpl(bool aE, qint64 s) + : QNonContiguousByteDevice(), +@@ -197,7 +198,8 @@ public: + m_amount(0), + m_data(0), + m_atEnd(aE), +- m_size(s) ++ m_size(s), ++ m_pos(0) + { + } + +@@ -205,6 +207,11 @@ public: + { + } + ++ qint64 pos() ++ { ++ return m_pos; ++ } ++ + const char* readPointer(qint64 maximumLength, qint64 &len) + { + if (m_amount > 0) { +@@ -232,11 +239,10 @@ public: + + m_amount -= a; + m_data += a; ++ m_pos += a; + +- // To main thread to inform about our state +- emit processedData(a); +- +- // FIXME possible optimization, already ask user thread for some data ++ // To main thread to inform about our state. The m_pos will be sent as a sanity check. ++ emit processedData(m_pos, a); + + return true; + } +@@ -253,10 +259,21 @@ public: + { + m_amount = 0; + m_data = 0; ++ m_dataArray.clear(); ++ ++ if (wantDataPending) { ++ // had requested the user thread to send some data (only 1 in-flight at any moment) ++ wantDataPending = false; ++ } + + // Communicate as BlockingQueuedConnection + bool b = false; + emit resetData(&b); ++ if (b) { ++ // the reset succeeded, we're at pos 0 again ++ m_pos = 0; ++ // the HTTP code will anyway abort the request if !b. ++ } + return b; + } + +@@ -267,8 +284,13 @@ public: + + public slots: + // From user thread: +- void haveDataSlot(QByteArray dataArray, bool dataAtEnd, qint64 dataSize) ++ void haveDataSlot(qint64 pos, QByteArray dataArray, bool dataAtEnd, qint64 dataSize) + { ++ if (pos != m_pos) { ++ // Sometimes when re-sending a request in the qhttpnetwork* layer there is a pending haveData from the ++ // user thread on the way to us. We need to ignore it since it is the data for the wrong(later) chunk. ++ return; ++ } + wantDataPending = false; + + m_dataArray = dataArray; +@@ -288,7 +310,7 @@ signals: + + // to main thread: + void wantData(qint64); +- void processedData(qint64); ++ void processedData(qint64 pos, qint64 amount); + void resetData(bool *b); + }; + +diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp +index cc67258..fe2f627 100644 +--- a/src/network/access/qnetworkaccesshttpbackend.cpp ++++ b/src/network/access/qnetworkaccesshttpbackend.cpp +@@ -193,6 +193,7 @@ QNetworkAccessHttpBackendFactory::create(QNetworkAccessManager::Operation op, + QNetworkAccessHttpBackend::QNetworkAccessHttpBackend() + : QNetworkAccessBackend() + , statusCode(0) ++ , uploadByteDevicePosition(false) + , pendingDownloadDataEmissions(new QAtomicInt()) + , pendingDownloadProgressEmissions(new QAtomicInt()) + , loadingFromCache(false) +@@ -610,9 +611,9 @@ void QNetworkAccessHttpBackend::postRequest() + forwardUploadDevice->setParent(delegate); // needed to make sure it is moved on moveToThread() + delegate->httpRequest.setUploadByteDevice(forwardUploadDevice); + +- // From main thread to user thread: +- QObject::connect(this, SIGNAL(haveUploadData(QByteArray, bool, qint64)), +- forwardUploadDevice, SLOT(haveDataSlot(QByteArray, bool, qint64)), Qt::QueuedConnection); ++ // From user thread to http thread: ++ QObject::connect(this, SIGNAL(haveUploadData(qint64,QByteArray,bool,qint64)), ++ forwardUploadDevice, SLOT(haveDataSlot(qint64,QByteArray,bool,qint64)), Qt::QueuedConnection); + QObject::connect(uploadByteDevice.data(), SIGNAL(readyRead()), + forwardUploadDevice, SIGNAL(readyRead()), + Qt::QueuedConnection); +@@ -620,8 +621,8 @@ void QNetworkAccessHttpBackend::postRequest() + // From http thread to user thread: + QObject::connect(forwardUploadDevice, SIGNAL(wantData(qint64)), + this, SLOT(wantUploadDataSlot(qint64))); +- QObject::connect(forwardUploadDevice, SIGNAL(processedData(qint64)), +- this, SLOT(sentUploadDataSlot(qint64))); ++ QObject::connect(forwardUploadDevice,SIGNAL(processedData(qint64, qint64)), ++ this, SLOT(sentUploadDataSlot(qint64,qint64))); + connect(forwardUploadDevice, SIGNAL(resetData(bool*)), + this, SLOT(resetUploadDataSlot(bool*)), + Qt::BlockingQueuedConnection); // this is the only one with BlockingQueued! +@@ -915,12 +916,21 @@ void QNetworkAccessHttpBackend::replySslConfigurationChanged(const QSslConfigura + void QNetworkAccessHttpBackend::resetUploadDataSlot(bool *r) + { + *r = uploadByteDevice->reset(); ++ if (*r) { ++ // reset our own position which is used for the inter-thread communication ++ uploadByteDevicePosition = 0; ++ } + } + + // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread +-void QNetworkAccessHttpBackend::sentUploadDataSlot(qint64 amount) ++void QNetworkAccessHttpBackend::sentUploadDataSlot(qint64 pos, qint64 amount) + { ++ if (uploadByteDevicePosition + amount != pos) { ++ // Sanity check, should not happen. ++ error(QNetworkReply::UnknownNetworkError, ""); ++ } + uploadByteDevice->advanceReadPointer(amount); ++ uploadByteDevicePosition += amount; + } + + // Coming from QNonContiguousByteDeviceThreadForwardImpl in HTTP thread +@@ -933,7 +943,7 @@ void QNetworkAccessHttpBackend::wantUploadDataSlot(qint64 maxSize) + QByteArray dataArray(data, currentUploadDataLength); + + // Communicate back to HTTP thread +- emit haveUploadData(dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); ++ emit haveUploadData(uploadByteDevicePosition, dataArray, uploadByteDevice->atEnd(), uploadByteDevice->size()); + } + + /* +diff --git a/src/network/access/qnetworkaccesshttpbackend_p.h b/src/network/access/qnetworkaccesshttpbackend_p.h +index 13519c6..b4ed67c 100644 +--- a/src/network/access/qnetworkaccesshttpbackend_p.h ++++ b/src/network/access/qnetworkaccesshttpbackend_p.h +@@ -112,7 +112,7 @@ signals: + + void startHttpRequestSynchronously(); + +- void haveUploadData(QByteArray dataArray, bool dataAtEnd, qint64 dataSize); ++ void haveUploadData(const qint64 pos, QByteArray dataArray, bool dataAtEnd, qint64 dataSize); + private slots: + // From HTTP thread: + void replyDownloadData(QByteArray); +@@ -129,13 +129,14 @@ private slots: + // From QNonContiguousByteDeviceThreadForwardImpl in HTTP thread: + void resetUploadDataSlot(bool *r); + void wantUploadDataSlot(qint64); +- void sentUploadDataSlot(qint64); ++ void sentUploadDataSlot(qint64, qint64); + + bool sendCacheContents(const QNetworkCacheMetaData &metaData); + + private: + QHttpNetworkRequest httpRequest; // There is also a copy in the HTTP thread + int statusCode; ++ qint64 uploadByteDevicePosition; + QString reasonPhrase; + // Will be increased by HTTP thread: + QSharedPointer pendingDownloadDataEmissions; + diff --git a/dev-qt/qtcore/qtcore-4.8.6-r2.ebuild b/dev-qt/qtcore/qtcore-4.8.6-r2.ebuild new file mode 100644 index 000000000000..c5429c8a8c37 --- /dev/null +++ b/dev-qt/qtcore/qtcore-4.8.6-r2.ebuild @@ -0,0 +1,92 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-qt/qtcore/qtcore-4.8.6-r2.ebuild,v 1.1 2015/05/07 08:49:35 yngwin Exp $ + +EAPI=5 + +inherit qt4-build-multilib + +DESCRIPTION="Cross-platform application development framework" + +if [[ ${QT4_BUILD_TYPE} == live ]]; then + KEYWORDS="" +else + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris" +fi + +IUSE="+glib iconv icu qt3support ssl" + +DEPEND=" + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] + glib? ( dev-libs/glib:2[${MULTILIB_USEDEP}] ) + icu? ( dev-libs/icu:=[${MULTILIB_USEDEP}] ) + ssl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] ) +" +RDEPEND="${DEPEND}" +PDEPEND=" + ~dev-qt/qttranslations-${PV} + qt3support? ( ~dev-qt/qtgui-${PV}[aqua=,debug=,glib=,qt3support,${MULTILIB_USEDEP}] ) +" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/qt4/Qt/qconfig.h + /usr/include/qt4/QtCore/qconfig.h +) + +PATCHES=( + "${FILESDIR}/${PN}-4.8.5-moc-boost-lexical-cast.patch" + "${FILESDIR}/${PN}-4.8.5-honor-ExcludeSocketNotifiers-in-glib-event-loop.patch" # bug 514968 + "${FILESDIR}/${PN}-4.8.5-qeventdispatcher-recursive.patch" # bug 514968 + "${FILESDIR}/${PN}-4.8.6-QNAM-corruptions-fix.patch" # bug 548622 +) + +QT4_TARGET_DIRECTORIES=" + src/tools/bootstrap + src/tools/moc + src/tools/rcc + src/tools/uic + src/corelib + src/network + src/xml + src/plugins/codecs/cn + src/plugins/codecs/jp + src/plugins/codecs/kr + src/plugins/codecs/tw + tools/linguist/lconvert + tools/linguist/lrelease + tools/linguist/lupdate" + +QCONFIG_DEFINE="QT_ZLIB" + +src_prepare() { + qt4-build-multilib_src_prepare + + # bug 172219 + sed -i -e "s:CXXFLAGS.*=:CXXFLAGS=${CXXFLAGS} :" \ + -e "s:LFLAGS.*=:LFLAGS=${LDFLAGS} :" \ + qmake/Makefile.unix || die "sed qmake/Makefile.unix failed" + + # bug 427782 + sed -i -e '/^CPPFLAGS\s*=/ s/-g //' \ + qmake/Makefile.unix || die "sed CPPFLAGS in qmake/Makefile.unix failed" + sed -i -e 's/setBootstrapVariable QMAKE_CFLAGS_RELEASE/QMakeVar set QMAKE_CFLAGS_RELEASE/' \ + -e 's/setBootstrapVariable QMAKE_CXXFLAGS_RELEASE/QMakeVar set QMAKE_CXXFLAGS_RELEASE/' \ + configure || die "sed configure setBootstrapVariable failed" +} + +multilib_src_configure() { + local myconf=( + -no-accessibility -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon + -no-phonon-backend -no-svg -no-webkit -no-script -no-scripttools -no-declarative + -system-zlib -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg + -no-cups -no-dbus -no-gtkstyle -no-nas-sound -no-opengl -no-openvg + -no-sm -no-xshape -no-xvideo -no-xsync -no-xinerama -no-xcursor -no-xfixes + -no-xrandr -no-xrender -no-mitshm -no-fontconfig -no-freetype -no-xinput -no-xkb + $(qt_use glib) + $(qt_use iconv) + $(qt_use icu) + $(use ssl && echo -openssl-linked || echo -no-openssl) + $(qt_use qt3support) + ) + qt4_multilib_src_configure +} -- 2.26.2