From eae0cb09f1310e755c2aff7c1112f7a6c09d7a53 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 19 Jun 2015 15:35:34 +0200 Subject: Network: Fix up previous corruption patch This is a fix-up for cff39fba10ffc10ee4dcfdc66ff6528eb26462d3. That patch lead to some internal state issues that lead to the QTBUG-47048 or to QNetworkReply objects erroring with "Connection Closed" when the server closed the Keep-Alive connection. This patch changes the QNAM socket slot connections to be DirectConnection. We don't close the socket anymore in slots where it is anyway in a closed state afterwards. This prevents event/stack recursions. We also flush QSslSocket/QTcpSocket receive buffers when receiving a disconnect so that the developer always gets the full decrypted data from the buffers. [ChangeLog][QtNetwork] Fix HTTP issues with "Unknown Error" and "Connection Closed" [ChangeLog][QtNetwork][Sockets] Read OS/encrypted read buffers when connection closed by server. Change-Id: Ib4d6a2d0d988317e3a5356f36e8dbcee4590beed Task-number: QTBUG-47048 Reviewed-by: Kai Koehne Reviewed-by: Richard J. Moore --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/auto/network/access') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index d2edf67a82..138f528a8a 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -1051,7 +1051,7 @@ protected: // clean up QAbstractSocket's residue: while (client->bytesToWrite() > 0) { qDebug() << "Still having" << client->bytesToWrite() << "bytes to write, doing that now"; - if (!client->waitForBytesWritten(2000)) { + if (!client->waitForBytesWritten(10000)) { qDebug() << "ERROR: FastSender:" << client->error() << "cleaning up residue"; return; } @@ -1071,7 +1071,7 @@ protected: measuredSentBytes += writeNextData(client, bytesToWrite); while (client->bytesToWrite() > 0) { - if (!client->waitForBytesWritten(2000)) { + if (!client->waitForBytesWritten(10000)) { qDebug() << "ERROR: FastSender:" << client->error() << "during blocking write"; return; } @@ -7946,7 +7946,7 @@ public slots: m_receivedData += data; if (!m_parsedHeaders && m_receivedData.contains("\r\n\r\n")) { m_parsedHeaders = true; - QTimer::singleShot(qrand()%10, this, SLOT(closeDelayed())); // simulate random network latency + QTimer::singleShot(qrand()%60, this, SLOT(closeDelayed())); // simulate random network latency // This server simulates a web server connection closing, e.g. because of Apaches MaxKeepAliveRequests or KeepAliveTimeout // In this case QNAM needs to re-send the upload data but it had a bug which then corrupts the upload // This test catches that. @@ -8052,11 +8052,12 @@ void tst_QNetworkReply::putWithServerClosingConnectionImmediately() // get the request started and the incoming socket connected QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); //qDebug() << "correct=" << server.m_correctUploads << "corrupt=" << server.m_corruptUploads << "expected=" < 5); + QVERIFY(server.m_correctUploads > 2); // Because actually important is that we don't get any corruption: QCOMPARE(server.m_corruptUploads, 0); -- cgit v1.2.3 From 9fe0ff082c7edc31c1949f55044adde32067bfa0 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 6 Aug 2015 10:55:34 +0200 Subject: Extend QNetworkReply test exclusion on OS X The test is very flakey in 5.5 integrations and the OS X CI machines have notorious problems with networking stability. So the previously listed tests are not really at fault, it's an infrastructure problem, that we choose to ignore for the time being. Change-Id: I7fbfa7b3778daa6b5e60d95b822847c92927122f Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll --- tests/auto/network/access/qnetworkreply/BLACKLIST | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'tests/auto/network/access') diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index 54dcff071e..3ec580ddde 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -1,15 +1,8 @@ -[ioGetFromBuiltinHttp:http+limited] osx +[ioGetFromBuiltinHttp:http+limited] ubuntu-14.04 [ioGetFromBuiltinHttp:https+limited] -osx ubuntu-14.04 -[ioGetFromHttpBrokenServer:no-newline] -osx -[synchronousRequest:https] -osx -[SslHandshakeFailedError] -osx [httpAbort] * [backgroundRequestInterruption:ftp, bg, nobg] -- cgit v1.2.3