summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-08-31 14:46:59 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-08-31 14:51:21 (GMT)
commit9d24605add8daabfa55e1085e71ed47b14ed7d83 (patch)
tree391da3c4b0350cb1bbdf0ad04c53586b7de6fe44
parentb0295e82d08605a5a40803895544e57eeb6c8dc3 (diff)
downloadQt-9d24605add8daabfa55e1085e71ed47b14ed7d83.zip
Qt-9d24605add8daabfa55e1085e71ed47b14ed7d83.tar.gz
Qt-9d24605add8daabfa55e1085e71ed47b14ed7d83.tar.bz2
QNAM HTTP Code: Some tests where failing
ietf.org changed their server to use gzip, therefore our check for the content-length reply header was bogus. Rev-By: Peter Hartmann
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp8
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp6
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index c54bf3c..639464e 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -177,7 +177,9 @@ void tst_QHttpNetworkConnection::head()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
QVERIFY(reply->isFinished());
@@ -237,7 +239,9 @@ void tst_QHttpNetworkConnection::get()
QCOMPARE(reply->statusCode(), statusCode);
QCOMPARE(reply->reasonPhrase(), statusString);
- QCOMPARE(reply->contentLength(), qint64(contentLength));
+ // only check it if it is set
+ if (reply->contentLength() != -1)
+ QCOMPARE(reply->contentLength(), qint64(contentLength));
stopWatch.start();
QByteArray ba;
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 3216a6a..48a48f4 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1081,8 +1081,10 @@ void tst_QNetworkReply::getFromHttp()
QCOMPARE(reply->url(), request.url());
QCOMPARE(reply->error(), QNetworkReply::NoError);
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
-
- QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
+ QCOMPARE(reply->size(), reference.size());
+ // only compare when the header is set.
+ if (reply->header(QNetworkRequest::ContentLengthHeader).isValid())
+ QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), reference.size());
QCOMPARE(reply->readAll(), reference.readAll());
}