From a78e1848118b16cbf517d14926663d175e3fb927 Mon Sep 17 00:00:00 2001 From: shiroki Date: Wed, 25 May 2011 11:11:51 +0200 Subject: fix "Host" header of ipv6 URLs in QNAM Change-Id: I6bf3320e5ab285e3d1f4d72bd1ef0a0e42813e5b Reviewed-on: http://codereview.qt.nokia.com/115 Reviewed-by: Markus Goetz --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/auto/qnetworkreply/tst_qnetworkreply.cpp') diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 4f5bd193c5..67b6e5c5b4 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -457,9 +457,9 @@ public: : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6), multiple(false), totalConnections(0) { - if( useipv6 ){ + if (useipv6) { listen(QHostAddress::AnyIPv6); - }else{ + } else { listen(); } if (thread) { @@ -2338,8 +2338,9 @@ void tst_QNetworkReply::connectToIPv6Address_data() QTest::addColumn("url"); QTest::addColumn("error"); QTest::addColumn("dataToSend"); - QTest::addColumn("serverVerifyData"); - QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("\r\nHost: [::1]\r\n"); + QTest::addColumn("hostfield"); + QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("[::1]"); + //QTest::newRow("ipv4localhost") << QUrl(QByteArray("http://127.0.0.1")) << QNetworkReply::NoError<< QByteArray("ipv4localhost") << QByteArray("127.0.0.1"); //to add more test data here } @@ -2348,7 +2349,7 @@ void tst_QNetworkReply::connectToIPv6Address() QFETCH(QUrl, url); QFETCH(QNetworkReply::NetworkError, error); QFETCH(QByteArray, dataToSend); - QFETCH(QByteArray, serverVerifyData); + QFETCH(QByteArray, hostfield); QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: "); httpResponse += QByteArray::number(dataToSend.size()); @@ -2366,10 +2367,9 @@ void tst_QNetworkReply::connectToIPv6Address() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); QByteArray content = reply->readAll(); - if( !serverVerifyData.isEmpty()){ - //qDebug() << server.receivedData; - //QVERIFY(server.receivedData.contains(serverVerifyData)); //got a bug here - } + //qDebug() << server.receivedData; + QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QVERIFY(server.receivedData.contains(hostinfo)); QVERIFY(content == dataToSend); QCOMPARE(reply->url(), request.url()); QVERIFY(reply->error() == error); -- cgit v1.2.3