diff options
author | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:11:51 (GMT) |
---|---|---|
committer | shiroki <shiroki@cuteqt.com> | 2011-05-25 09:15:53 (GMT) |
commit | 4ab5a2bc78e142d0035299090e3ad8bee81eed9f (patch) | |
tree | 211f877326d55d8d17c78ed7c372fc31327ca5c6 /tests/auto/qnetworkreply | |
parent | 00bf2e2605b97ff77efdcb68b7968375b3e9d195 (diff) | |
download | Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.zip Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.tar.gz Qt-4ab5a2bc78e142d0035299090e3ad8bee81eed9f.tar.bz2 |
fix "Host" header of ipv6 URLs in QNAM
Reviewed-by: Markus Goetz
Diffstat (limited to 'tests/auto/qnetworkreply')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 203de5b..113b64b 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) { @@ -2329,8 +2329,9 @@ void tst_QNetworkReply::connectToIPv6Address_data() QTest::addColumn<QUrl>("url"); QTest::addColumn<QNetworkReply::NetworkError>("error"); QTest::addColumn<QByteArray>("dataToSend"); - QTest::addColumn<QByteArray>("serverVerifyData"); - QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("\r\nHost: [::1]\r\n"); + QTest::addColumn<QByteArray>("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 } @@ -2339,7 +2340,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()); @@ -2357,10 +2358,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); |