summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkreply
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2010-08-23 14:49:08 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2010-08-23 14:50:06 (GMT)
commitd38eb22b9f5b408d67ea0244e45c13d6d0665d8d (patch)
tree281ad1ff29334ba4939fdf5166577998948dc6c4 /tests/auto/qnetworkreply
parent8c47746c8da6d9d431e69fb2a828e151c36318d0 (diff)
downloadQt-d38eb22b9f5b408d67ea0244e45c13d6d0665d8d.zip
Qt-d38eb22b9f5b408d67ea0244e45c13d6d0665d8d.tar.gz
Qt-d38eb22b9f5b408d67ea0244e45c13d6d0665d8d.tar.bz2
QNAM HTTP: Prepare a compression auto test related to a future bugfix
Task-number: QTBUG-12908
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index ca563ef..2ff02d4 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -281,6 +281,8 @@ private Q_SLOTS:
void symbianOpenCDataUrlCrash();
+ void qtbug12908compressedHttpReply();
+
// NOTE: This test must be last!
void parentingRepliesToTheApp();
};
@@ -4171,6 +4173,30 @@ void tst_QNetworkReply::symbianOpenCDataUrlCrash()
QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(598));
}
+// TODO:
+// Prepare a gzip that has one chunk that expands to the size mentioned in the bugreport.
+// Then have a custom HTTP server that waits after this chunk so the returning gets
+// triggered.
+void tst_QNetworkReply::qtbug12908compressedHttpReply()
+{
+ QString header("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 63\r\n\r\n");
+
+ // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz
+ QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA");
+ QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii());
+
+ MiniHttpServer server(header.toAscii() + decodedFile);
+ server.doClose = true;
+
+ QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort())));
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+}
// NOTE: This test must be last testcase in tst_qnetworkreply!