summaryrefslogtreecommitdiffstats
path: root/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp')
-rw-r--r--tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
index 6767c8b153..05ede9da99 100644
--- a/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
+++ b/tests/manual/network_remote_stresstest/tst_network_remote_stresstest.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -246,30 +241,31 @@ void tst_NetworkRemoteStressTest::blockingSequentialRemoteHosts()
socket = QSharedPointer<QTcpSocket>(new QTcpSocket);
socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80));
- QVERIFY2(socket->waitForConnected(10000), "Timeout connecting to " + url.encodedHost());
+ const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
+ QVERIFY2(socket->waitForConnected(10000), "Timeout connecting to " + encodedHost);
#ifndef QT_NO_SSL
if (isHttps) {
static_cast<QSslSocket *>(socket.data())->setProtocol(QSsl::TlsV1_0);
static_cast<QSslSocket *>(socket.data())->startClientEncryption();
static_cast<QSslSocket *>(socket.data())->ignoreSslErrors();
- QVERIFY2(static_cast<QSslSocket *>(socket.data())->waitForEncrypted(10000), "Timeout starting TLS with " + url.encodedHost());
+ QVERIFY2(static_cast<QSslSocket *>(socket.data())->waitForEncrypted(10000), "Timeout starting TLS with " + encodedHost);
}
#endif // QT_NO_SSL
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
- "Host: " + url.encodedHost() + "\r\n"
+ "Host: " + encodedHost + "\r\n"
"\r\n");
while (socket->bytesToWrite())
- QVERIFY2(socket->waitForBytesWritten(10000), "Timeout writing to " + url.encodedHost());
+ QVERIFY2(socket->waitForBytesWritten(10000), "Timeout writing to " + encodedHost);
while (socket->state() == QAbstractSocket::ConnectedState && !timeout.hasExpired(10000)) {
socket->waitForReadyRead(10000);
byteCounter += socket->readAll().size(); // discard
}
- QVERIFY2(!timeout.hasExpired(10000), "Timeout reading from " + url.encodedHost());
+ QVERIFY2(!timeout.hasExpired(10000), "Timeout reading from " + encodedHost);
totalBytes += byteCounter;
if (intermediateDebug) {
@@ -318,16 +314,17 @@ void tst_NetworkRemoteStressTest::sequentialRemoteHosts()
socket->connectToHost(url.host(), url.port(80));
}
+ const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
- "Host: " + url.encodedHost() + "\r\n"
+ "Host: " + encodedHost + "\r\n"
"\r\n");
connect(socket.data(), SIGNAL(readyRead()), SLOT(slotReadAll()));
QTestEventLoop::instance().connect(socket.data(), SIGNAL(disconnected()), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(30);
- QVERIFY2(!QTestEventLoop::instance().timeout(), "Timeout with " + url.encodedHost() + "; "
+ QVERIFY2(!QTestEventLoop::instance().timeout(), "Timeout with " + encodedHost + "; "
+ QByteArray::number(socket->bytesToWrite()) + " bytes to write");
totalBytes += byteCounter;
@@ -397,10 +394,11 @@ void tst_NetworkRemoteStressTest::parallelRemoteHosts()
socket->connectToHost(url.host(), url.port(isHttps ? 443 : 80));
}
+ const QByteArray encodedHost = url.host(QUrl::FullyEncoded).toLatin1();
socket->write("GET " + url.toEncoded(QUrl::RemoveScheme | QUrl::RemoveAuthority | QUrl::RemoveFragment) + " HTTP/1.0\r\n"
"Connection: close\r\n"
"User-Agent: tst_QTcpSocket_stresstest/1.0\r\n"
- "Host: " + url.encodedHost() + "\r\n"
+ "Host: " + encodedHost + "\r\n"
"\r\n");
connect(socket, SIGNAL(readyRead()), SLOT(slotReadAll()));
QTestEventLoop::instance().connect(socket, SIGNAL(disconnected()), SLOT(exitLoop()));