summaryrefslogtreecommitdiffstats
path: root/tests/auto/network
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/network')
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp179
-rw-r--r--tests/auto/network/access/qabstractnetworkcache/BLACKLIST2
-rw-r--r--tests/auto/network/access/qftp/BLACKLIST11
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp80
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST246
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp14
-rw-r--r--tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp7
-rw-r--r--tests/auto/network/access/spdy/BLACKLIST10
-rw-r--r--tests/auto/network/kernel/qdnslookup/BLACKLIST12
-rw-r--r--tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp3
-rw-r--r--tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp17
-rw-r--r--tests/auto/network/socket/platformsocketengine/BLACKLIST9
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/BLACKLIST5
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/BLACKLIST11
-rw-r--r--tests/auto/network/socket/qtcpserver/BLACKLIST25
-rw-r--r--tests/auto/network/socket/qtcpsocket/BLACKLIST13
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp39
-rw-r--r--tests/auto/network/socket/qudpsocket/BLACKLIST28
-rw-r--r--tests/auto/network/socket/qudpsocket/clientserver/main.cpp2
-rw-r--r--tests/auto/network/ssl/qsslcertificate/BLACKLIST12
-rw-r--r--tests/auto/network/ssl/qsslkey/BLACKLIST18
-rw-r--r--tests/auto/network/ssl/qsslsocket/BLACKLIST18
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp248
-rw-r--r--tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp30
-rw-r--r--tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp2
25 files changed, 829 insertions, 212 deletions
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index e24370fc87..bf3d936446 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -46,6 +46,7 @@
#endif // NO_SSL
#include <cstdlib>
+#include <memory>
#include <string>
#include "emulationdetector.h"
@@ -71,6 +72,8 @@ class tst_Http2 : public QObject
public:
tst_Http2();
~tst_Http2();
+public slots:
+ void init();
private slots:
// Tests:
void singleRequest_data();
@@ -82,6 +85,8 @@ private slots:
void goaway_data();
void goaway();
void earlyResponse();
+ void connectToHost_data();
+ void connectToHost();
protected slots:
// Slots to listen to our in-process server:
@@ -115,7 +120,7 @@ private:
quint16 serverPort = 0;
QThread *workerThread = nullptr;
- QNetworkAccessManager manager;
+ std::unique_ptr<QNetworkAccessManager> manager;
QTestEventLoop eventLoop;
@@ -129,6 +134,10 @@ private:
static const Http2::RawSettings defaultServerSettings;
};
+#define STOP_ON_FAILURE \
+ if (QTest::currentTestFailed()) \
+ return;
+
const Http2::RawSettings tst_Http2::defaultServerSettings{{Http2::Settings::MAX_CONCURRENT_STREAMS_ID, 100}};
namespace {
@@ -174,6 +183,11 @@ tst_Http2::~tst_Http2()
}
}
+void tst_Http2::init()
+{
+ manager.reset(new QNetworkAccessManager);
+}
+
void tst_Http2::singleRequest_data()
{
QTest::addColumn<QNetworkRequest::Attribute>("h2Attribute");
@@ -228,13 +242,14 @@ void tst_Http2::singleRequest()
QFETCH(const QNetworkRequest::Attribute, h2Attribute);
request.setAttribute(h2Attribute, QVariant(true));
- auto reply = manager.get(request);
+ auto reply = manager->get(request);
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
// Since we're using self-signed certificates,
// ignore SSL errors:
reply->ignoreSslErrors();
runEventLoop();
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
@@ -270,6 +285,7 @@ void tst_Http2::multipleRequests()
sendRequest(i, priorities[QRandomGenerator::global()->bounded(3)]);
runEventLoop();
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
@@ -299,7 +315,7 @@ void tst_Http2::flowControlClientSide()
params.maxSessionReceiveWindowSize = Http2::defaultSessionWindowSize * 5;
params.settingsFrameData[Settings::INITIAL_WINDOW_SIZE_ID] = Http2::defaultSessionWindowSize;
// Inform our manager about non-default settings:
- manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
+ manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
const Http2::RawSettings serverSettings = {{Settings::MAX_CONCURRENT_STREAMS_ID, quint32(3)}};
ServerPtr srv(newServer(serverSettings, defaultConnectionType(), params));
@@ -317,6 +333,7 @@ void tst_Http2::flowControlClientSide()
sendRequest(i);
runEventLoop(120000);
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
@@ -357,6 +374,7 @@ void tst_Http2::flowControlServerSide()
sendRequest(i, QNetworkRequest::NormalPriority, payload);
runEventLoop(120000);
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
@@ -377,7 +395,7 @@ void tst_Http2::pushPromise()
Http2::ProtocolParameters params;
// Defaults are good, except ENABLE_PUSH:
params.settingsFrameData[Settings::ENABLE_PUSH_ID] = 1;
- manager.setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
+ manager->setProperty(Http2::http2ParametersPropertyName, QVariant::fromValue(params));
ServerPtr srv(newServer(defaultServerSettings, defaultConnectionType(), params));
srv->enablePushPromise(true, QByteArray("/script.js"));
@@ -393,12 +411,13 @@ void tst_Http2::pushPromise()
QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
- auto reply = manager.get(request);
+ auto reply = manager->get(request);
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
// Since we're using self-signed certificates, ignore SSL errors:
reply->ignoreSslErrors();
runEventLoop();
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
@@ -416,7 +435,7 @@ void tst_Http2::pushPromise()
url.setPath("/script.js");
QNetworkRequest promisedRequest(url);
promisedRequest.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
- reply = manager.get(promisedRequest);
+ reply = manager->get(promisedRequest);
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
reply->ignoreSslErrors();
@@ -467,7 +486,7 @@ void tst_Http2::goaway()
url.setPath(QString("/%1").arg(i));
QNetworkRequest request(url);
request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, QVariant(true));
- replies[i] = manager.get(request);
+ replies[i] = manager->get(request);
QCOMPARE(replies[i]->error(), QNetworkReply::NoError);
void (QNetworkReply::*errorSignal)(QNetworkReply::NetworkError) =
&QNetworkReply::error;
@@ -477,6 +496,7 @@ void tst_Http2::goaway()
}
runEventLoop(5000 + responseTimeoutMS);
+ STOP_ON_FAILURE
// No request processed, no 'replyFinished' slot calls:
QCOMPARE(nRequests, 0);
@@ -520,10 +540,132 @@ void tst_Http2::earlyResponse()
sendRequest(1, QNetworkRequest::NormalPriority, {1000000, Qt::Uninitialized});
runEventLoop();
+ STOP_ON_FAILURE
+
+ QVERIFY(nRequests == 0);
+ QVERIFY(prefaceOK);
+ QVERIFY(serverGotSettingsACK);
+}
+
+void tst_Http2::connectToHost_data()
+{
+ // The attribute to set on a new request:
+ QTest::addColumn<QNetworkRequest::Attribute>("requestAttribute");
+ // The corresponding (to the attribute above) connection type the
+ // server will use:
+ QTest::addColumn<H2Type>("connectionType");
+
+#if QT_CONFIG(ssl)
+ QTest::addRow("encrypted-h2-direct") << QNetworkRequest::Http2DirectAttribute << H2Type::h2Direct;
+ if (!clearTextHTTP2)
+ QTest::addRow("encrypted-h2-ALPN") << QNetworkRequest::HTTP2AllowedAttribute << H2Type::h2Alpn;
+#endif // QT_CONFIG(ssl)
+ // This works for all configurations, tests 'preconnect-http' scheme:
+ // h2 with protocol upgrade is not working for now (the logic is a bit
+ // complicated there ...).
+ QTest::addRow("h2-direct") << QNetworkRequest::Http2DirectAttribute << H2Type::h2cDirect;
+}
+
+void tst_Http2::connectToHost()
+{
+ // QNetworkAccessManager::connectToHostEncrypted() and connectToHost()
+ // creates a special request with 'preconnect-https' or 'preconnect-http'
+ // schemes. At the level of the protocol handler we are supposed to report
+ // these requests as finished and wait for the real requests. This test will
+ // connect to a server with the first reply 'finished' signal meaning we
+ // indeed connected. At this point we check that a client preface was not
+ // sent yet, and no response received. Then we send the second (the real)
+ // request and do our usual checks. Since our server closes its listening
+ // socket on the first incoming connection (would not accept a new one),
+ // the successful completion of the second requests also means we were able
+ // to find a cached connection and re-use it.
+
+ QFETCH(const QNetworkRequest::Attribute, requestAttribute);
+ QFETCH(const H2Type, connectionType);
+
+ clearHTTP2State();
+
+ serverPort = 0;
+ nRequests = 2;
+
+ ServerPtr targetServer(newServer(defaultServerSettings, connectionType));
+
+#if QT_CONFIG(ssl)
+ Q_ASSERT(!clearTextHTTP2 || connectionType != H2Type::h2Alpn);
+#else
+ Q_ASSERT(connectionType == H2Type::h2c || connectionType == H2Type::h2cDirect);
+ Q_ASSERT(targetServer->isClearText());
+#endif // QT_CONFIG(ssl)
+
+ QMetaObject::invokeMethod(targetServer.data(), "startServer", Qt::QueuedConnection);
+ runEventLoop();
+
+ QVERIFY(serverPort != 0);
+
+ auto url = requestUrl(connectionType);
+ url.setPath("/index.html");
+
+ QNetworkReply *reply = nullptr;
+ // Here some mess with how we create this first reply:
+#if QT_CONFIG(ssl)
+ if (!targetServer->isClearText()) {
+ // Let's emulate what QNetworkAccessManager::connectToHostEncrypted() does.
+ // Alas, we cannot use it directly, since it does not return the reply and
+ // also does not know the difference between H2 with ALPN or direct.
+ auto copyUrl = url;
+ copyUrl.setScheme(QLatin1String("preconnect-https"));
+ QNetworkRequest request(copyUrl);
+ request.setAttribute(requestAttribute, true);
+ reply = manager->get(request);
+ // Since we're using self-signed certificates, ignore SSL errors:
+ reply->ignoreSslErrors();
+ } else
+#endif // QT_CONFIG(ssl)
+ {
+ // Emulating what QNetworkAccessManager::connectToHost() does with
+ // additional information that it cannot provide (the attribute).
+ auto copyUrl = url;
+ copyUrl.setScheme(QLatin1String("preconnect-http"));
+ QNetworkRequest request(copyUrl);
+ request.setAttribute(requestAttribute, true);
+ reply = manager->get(request);
+ }
+
+ connect(reply, &QNetworkReply::finished, [this, reply]() {
+ --nRequests;
+ eventLoop.exitLoop();
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QVERIFY(reply->isFinished());
+ // Nothing must be sent yet:
+ QVERIFY(!prefaceOK);
+ QVERIFY(!serverGotSettingsACK);
+ // Nothing received back:
+ QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
+ QCOMPARE(reply->readAll().size(), 0);
+ });
+
+ runEventLoop();
+ STOP_ON_FAILURE
+
+ QCOMPARE(nRequests, 1);
+
+ QNetworkRequest request(url);
+ request.setAttribute(requestAttribute, QVariant(true));
+ reply = manager->get(request);
+ connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
+ // Note, unlike the first request, when the connection is ecnrytped, we
+ // do not ignore TLS errors on this reply - we should re-use existing
+ // connection, there TLS errors were already ignored.
+
+ runEventLoop();
+ STOP_ON_FAILURE
QVERIFY(nRequests == 0);
QVERIFY(prefaceOK);
QVERIFY(serverGotSettingsACK);
+
+ QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QVERIFY(reply->isFinished());
}
void tst_Http2::serverStarted(quint16 port)
@@ -537,7 +679,7 @@ void tst_Http2::clearHTTP2State()
windowUpdates = 0;
prefaceOK = false;
serverGotSettingsACK = false;
- manager.setProperty(Http2::http2ParametersPropertyName, QVariant());
+ manager->setProperty(Http2::http2ParametersPropertyName, QVariant());
}
void tst_Http2::runEventLoop(int ms)
@@ -590,9 +732,9 @@ void tst_Http2::sendRequest(int streamNumber,
QNetworkReply *reply = nullptr;
if (payload.size())
- reply = manager.post(request, payload);
+ reply = manager->post(request, payload);
else
- reply = manager.get(request);
+ reply = manager->get(request);
reply->ignoreSslErrors();
connect(reply, &QNetworkReply::finished, this, &tst_Http2::replyFinished);
@@ -684,14 +826,29 @@ void tst_Http2::replyFinished()
QVERIFY(nRequests);
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
+ if (reply->error() != QNetworkReply::NoError)
+ stopEventLoop();
+
QCOMPARE(reply->error(), QNetworkReply::NoError);
+
const QVariant http2Used(reply->attribute(QNetworkRequest::HTTP2WasUsedAttribute));
+ if (!http2Used.isValid() || !http2Used.toBool())
+ stopEventLoop();
+
QVERIFY(http2Used.isValid());
QVERIFY(http2Used.toBool());
+
const QVariant spdyUsed(reply->attribute(QNetworkRequest::SpdyWasUsedAttribute));
+ if (!spdyUsed.isValid() || spdyUsed.toBool())
+ stopEventLoop();
+
QVERIFY(spdyUsed.isValid());
QVERIFY(!spdyUsed.toBool());
+
const QVariant code(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute));
+ if (!code.isValid() || !code.canConvert<int>() || code.value<int>() != 200)
+ stopEventLoop();
+
QVERIFY(code.isValid());
QVERIFY(code.canConvert<int>());
QCOMPARE(code.value<int>(), 200);
@@ -709,6 +866,8 @@ void tst_Http2::replyFinishedWithError()
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
// For now this is a 'generic' code, it just verifies some error was
// reported without testing its type.
+ if (reply->error() == QNetworkReply::NoError)
+ stopEventLoop();
QVERIFY(reply->error() != QNetworkReply::NoError);
}
diff --git a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST
index 2ad52f8b31..12f45f0e12 100644
--- a/tests/auto/network/access/qabstractnetworkcache/BLACKLIST
+++ b/tests/auto/network/access/qabstractnetworkcache/BLACKLIST
@@ -1,2 +1,2 @@
[cacheControl]
-windows
+windows-10 msvc-2015
diff --git a/tests/auto/network/access/qftp/BLACKLIST b/tests/auto/network/access/qftp/BLACKLIST
index 96d9274653..463030a089 100644
--- a/tests/auto/network/access/qftp/BLACKLIST
+++ b/tests/auto/network/access/qftp/BLACKLIST
@@ -6,5 +6,16 @@ redhatenterpriselinuxworkstation-6.6
[activeMode:WithoutProxyWithSession]
redhatenterpriselinuxworkstation-6.6
+[list]
+ubuntu-16.04
+opensuse-leap
+osx-10.11
+windows-7sp1
+ubuntu-18.04
+osx-10.14
+b2qt
+osx-10.12
+windows-10 msvc-2015
+opensuse-42.3
[list:epsvNotSupported]
*
diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp
index a04c2ae01d..2068738a67 100644
--- a/tests/auto/network/access/qftp/tst_qftp.cpp
+++ b/tests/auto/network/access/qftp/tst_qftp.cpp
@@ -134,8 +134,8 @@ private:
bool fileExists( const QString &host, quint16 port, const QString &user, const QString &password, const QString &file, const QString &cdDir = QString() );
bool dirExists( const QString &host, quint16 port, const QString &user, const QString &password, const QString &cdDir, const QString &dirToCreate );
- void renameInit( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &createFile );
- void renameCleanup( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &fileToDelete );
+ void renameInit( const QString &host, const QString &user, const QString &password, const QString &createFile );
+ void renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete );
QFtp *ftp;
#ifndef QT_NO_BEARERMANAGEMENT
@@ -336,11 +336,7 @@ static QByteArray msgTimedOut(const QString &host, quint16 port = 0)
result += ':';
result += QByteArray::number(port);
}
-
- if (host == QtNetworkSettings::ftpServerName())
- return "(QTBUG-75549) Flaky results: " % result;
- else
- return result;
+ return result;
}
void tst_QFtp::connectToHost()
@@ -355,7 +351,7 @@ void tst_QFtp::connectToHost()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
QTEST( connectToHost_state, "state" );
@@ -438,7 +434,7 @@ void tst_QFtp::login()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Login );
QVERIFY( it != resultMap.end() );
@@ -486,7 +482,7 @@ void tst_QFtp::close()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
QCOMPARE( close_state, (int)QFtp::Unconnected );
@@ -554,7 +550,7 @@ void tst_QFtp::list()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::List );
QVERIFY( it != resultMap.end() );
@@ -615,7 +611,7 @@ void tst_QFtp::cd()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
}
ResMapIt it = resultMap.find( QFtp::Cd );
@@ -692,7 +688,7 @@ void tst_QFtp::get()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Get );
QVERIFY( it != resultMap.end() );
@@ -819,7 +815,7 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Put );
QVERIFY( it != resultMap.end() );
@@ -852,7 +848,7 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
QCOMPARE( done_success, 1 );
QTEST( buf.buffer(), "fileData" );
@@ -870,7 +866,7 @@ void tst_QFtp::put()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -934,7 +930,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( QFtp::Mkdir );
QVERIFY( it != resultMap.end() );
@@ -959,7 +955,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Mkdir );
QVERIFY( it != resultMap.end() );
@@ -979,7 +975,7 @@ void tst_QFtp::mkdir()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Rmdir );
QVERIFY( it != resultMap.end() );
@@ -1077,9 +1073,8 @@ void tst_QFtp::rename_data()
<< 0;
}
-void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &createFile )
+void tst_QFtp::renameInit( const QString &host, const QString &user, const QString &password, const QString &createFile )
{
- isSuccess = false;
if ( !createFile.isNull() ) {
// upload the file
init();
@@ -1093,7 +1088,7 @@ void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString &
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host) );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Put );
QVERIFY( it != resultMap.end() );
@@ -1101,12 +1096,10 @@ void tst_QFtp::renameInit( bool &isSuccess, const QString &host, const QString &
QVERIFY( fileExists( host, 21, user, password, createFile ) );
}
- isSuccess = true;
}
-void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QString &user, const QString &password, const QString &fileToDelete )
+void tst_QFtp::renameCleanup( const QString &host, const QString &user, const QString &password, const QString &fileToDelete )
{
- isSuccess = false;
if ( !fileToDelete.isNull() ) {
// cleanup (i.e. remove the file)
init();
@@ -1120,7 +1113,7 @@ void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QStrin
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host) );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -1128,7 +1121,6 @@ void tst_QFtp::renameCleanup( bool &isSuccess, const QString &host, const QStrin
QVERIFY( !fileExists( host, 21, user, password, fileToDelete ) );
}
- isSuccess = true;
}
void tst_QFtp::rename()
@@ -1151,10 +1143,7 @@ void tst_QFtp::rename()
if(renamedFile.contains('%'))
renamedFile = renamedFile.arg(uniqueExtension);
- bool isSuccess = true;
- renameInit(isSuccess, host, user, password, createFile);
- if (!isSuccess)
- QSKIP("(QTBUG-75549) abort test when there is an error in helper functions");
+ renameInit( host, user, password, createFile );
init();
ftp = newFtp();
@@ -1169,7 +1158,7 @@ void tst_QFtp::rename()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host) );
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Rename );
QVERIFY( it != resultMap.end() );
@@ -1184,9 +1173,7 @@ void tst_QFtp::rename()
QVERIFY( !fileExists( host, 21, user, password, renamedFile ) );
}
- renameCleanup(isSuccess, host, user, password, renamedFile);
- if (!isSuccess)
- QSKIP("(QTBUG-75549) abort test when there is an error in helper functions");
+ renameCleanup( host, user, password, renamedFile );
}
/*
@@ -1360,7 +1347,7 @@ void tst_QFtp::commandSequence()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host) );
+ QFAIL( msgTimedOut(host) );
QTEST( commandSequence_success, "success" );
}
@@ -1415,7 +1402,7 @@ void tst_QFtp::abort()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
ResMapIt it = resultMap.find( cmd );
QVERIFY( it != resultMap.end() );
@@ -1453,7 +1440,7 @@ void tst_QFtp::abort()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -1491,11 +1478,8 @@ void tst_QFtp::bytesAvailable()
addCommand( QFtp::Close, ftp->close() );
QTestEventLoop::instance().enterLoop( 40 );
- if ( QTestEventLoop::instance().timeout() ) {
- delete ftp;
- ftp = 0;
- QSKIP( msgTimedOut(host) );
- }
+ if ( QTestEventLoop::instance().timeout() )
+ QFAIL( msgTimedOut(host) );
ResMapIt it = resultMap.find( QFtp::Get );
QVERIFY( it != resultMap.end() );
@@ -1588,7 +1572,7 @@ void tst_QFtp::proxy()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() ) {
- QSKIP( msgTimedOut(host, port) );
+ QFAIL( msgTimedOut(host, port) );
}
ResMapIt it = resultMap.find( QFtp::Cd );
@@ -1623,7 +1607,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) );
+ QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) );
ResMapIt it = resultMap.find(QFtp::Put);
QVERIFY(it != resultMap.end());
@@ -1645,7 +1629,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) );
+ QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) );
ResMapIt it2 = resultMap.find(QFtp::Get);
QVERIFY(it2 != resultMap.end());
@@ -1668,7 +1652,7 @@ void tst_QFtp::binaryAscii()
delete ftp;
ftp = 0;
if ( QTestEventLoop::instance().timeout() )
- QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) );
+ QFAIL( msgTimedOut(QtNetworkSettings::ftpServerName()) );
it = resultMap.find( QFtp::Remove );
QVERIFY( it != resultMap.end() );
@@ -2100,7 +2084,7 @@ void tst_QFtp::doneSignal()
connect(&ftp, SIGNAL(done(bool)), &(QTestEventLoop::instance()), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(61);
if (QTestEventLoop::instance().timeout())
- QSKIP( msgTimedOut(QtNetworkSettings::ftpServerName()) );
+ QFAIL("Network operation timed out");
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().first().toBool(), false);
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
index 4d29a830e9..f9bbdd96c3 100644
--- a/tests/auto/network/access/qnetworkreply/BLACKLIST
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -1,47 +1,249 @@
# See qtbase/src/testlib/qtestblacklist.cpp for format
-osx
[authenticationCacheAfterCancel]
-windows
+windows-10 msvc-2017
+windows-10 msvc-2015
+osx-10.13
+windows-7sp1
[httpAbort]
-*
+ubuntu-16.04
+rhel-7.6
+[backgroundRequestInterruption]
+ubuntu-16.04
+opensuse-leap
+ubuntu-18.04
+b2qt
+osx-10.12
+windows-10 msvc-2015
+opensuse-42.3
[backgroundRequestInterruption:ftp, bg, nobg]
*
+[getErrors]
+osx-10.13
+# QTBUG-71953
[getErrors:ftp-host]
linux
# QTBUG-71953
+[getFromHttp]
+rhel-6.6
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+osx-10.11
+osx-10.13
+windows-7sp1
+ubuntu-18.04
+osx-10.14
+rhel-7.4
+b2qt
+windows-10 msvc-2017
+osx-10.12
+windows-10 msvc-2015
+opensuse-42.3
[getFromHttp:success-external]
*
[getFromHttpIntoBuffer]
-windows
+osx-10.12
+osx-10.13
[getFromHttpIntoBuffer2]
-windows
+windows-10 msvc-2015
+windows-10 msvc-2017
[headFromHttp]
-windows
+osx-10.13
+windows-10 msvc-2017
[ioGetFromHttpWithSocksProxy]
-windows
+osx-10.12
[ioPostToHttpFromSocket]
-windows
# QTBUG-66247
+osx-10.13
+windows-7sp1
+windows-10 msvc-2017
+osx-10.12
+windows-10 msvc-2015
[ioHttpRedirect]
-windows
+windows-10 msvc-2015
# QTBUG-66602
+windows-10 msvc-2017
[ioHttpRedirectMultipartPost]
-*
+ubuntu-16.04
+rhel-7.6
# QTBUG-66247
+opensuse-leap
+osx-10.13
+ubuntu-18.04
+rhel-7.4
+b2qt
+osx-10.12
+windows-10 msvc-2015
+opensuse-42.3
[ioHttpRedirectPolicy]
-*
+ubuntu-16.04
+opensuse-leap
+windows-7sp1
+ubuntu-18.04
+b2qt
+windows-10 msvc-2017
+windows-10 msvc-2015
+opensuse-42.3
[ioHttpRedirectPostPut]
-linux
-windows
+osx-10.12
+windows-10 msvc-2015
[putToFtp]
-windows ci
-[putToFtpWithInvalidCredentials]
-windows ci
+windows-10 msvc-2017
[putWithServerClosingConnectionImmediately]
-windows
+osx-10.11
+osx-10.13
+windows-7sp1
+windows-10 msvc-2017
+osx-10.12
+windows-10 msvc-2015
[qtbug28035browserDoesNotLoadQtProjectOrgCorrectly]
-windows
-[getFromUnreachableIp]
-windows msvc-2017
-[ioHttpRedirectErrors:too-many-redirects]
-rhel-6.6 ci
+windows-10 msvc-2015
+windows-7sp1
+[authenticationWithDifferentRealm]
+osx-10.13
+[backgroundRequest]
+osx-10.12
+[connectToIPv6Address]
+osx-10.12
+[deleteFromHttp]
+osx-10.12
+[downloadProgress]
+osx-10.12
+[emitErrorForAllReplies]
+osx-10.12
+[encrypted]
+osx-10.13
+[ftpAuthentication]
+osx-10.13
+[httpCanReadLine]
+osx-10.12
+osx-10.13
+[httpRecursiveCreation]
+osx-10.12
+osx-10.13
+[httpWithNoCredentialUsage]
+osx-10.12
+[ignoreSslErrorsList]
+osx-10.12
+osx-10.13
+[ignoreSslErrorsListWithSlot]
+osx-10.12
+osx-10.13
+[ioGetFromBuiltinHttp]
+osx-10.12
+osx-10.11
+osx-10.14
+osx-10.13
+[ioGetFromHttp]
+osx-10.12
+[ioGetFromHttpWithAuth]
+osx-10.12
+osx-10.13
+[ioGetFromHttpWithAuthSynchronous]
+osx-10.12
+[ioGetFromHttpWithProxyAuth]
+osx-10.12
+[ioGetFromHttpWithReuseParallel]
+osx-10.12
+osx-10.13
+[ioGetFromHttpWithReuseSequential]
+osx-10.12
+osx-10.13
+[ioGetFromHttpsWithIgnoreSslErrors]
+osx-10.12
+[ioGetFromHttpsWithSslErrors]
+osx-10.12
+[ioGetFromHttpsWithSslHandshakeError]
+osx-10.12
+[ioGetWithManyProxies]
+osx-10.12
+[ioPostToHttpFromFile]
+osx-10.13
+[ioPostToHttpFromMiddleOfFileFiveBytes]
+osx-10.13
+[ioPostToHttpFromMiddleOfFileToEnd]
+osx-10.13
+[ioPostToHttpFromMiddleOfQBufferFiveBytes]
+osx-10.13
+[ioPostToHttpFromSocketSynchronous]
+osx-10.12
+osx-10.13
+[ioPostToHttpNoBufferFlag]
+osx-10.13
+[ioPostToHttpUploadProgress]
+osx-10.12
+osx-10.11
+osx-10.13
+[ioPutToHttpFromFile]
+osx-10.13
+[lastModifiedHeaderForHttp]
+osx-10.12
+osx-10.13
+[multipartSkipIndices]
+osx-10.12
+osx-10.13
+[nestedEventLoops]
+osx-10.12
+osx-10.13
+[pipelining]
+osx-10.13
+[postToHttp]
+osx-10.12
+osx-10.13
+[postToHttpMultipart]
+osx-10.12
+osx-10.13
+[postToHttpSynchronous]
+osx-10.12
+osx-10.13
+[postToHttps]
+osx-10.12
+osx-10.13
+[postToHttpsMultipart]
+osx-10.12
+osx-10.13
+[postToHttpsSynchronous]
+osx-10.12
+osx-10.13
+[putGetDeleteGetFromHttp]
+osx-10.12
+[putToHttp]
+osx-10.12
+osx-10.13
+[putToHttpSynchronous]
+osx-10.12
+osx-10.13
+[putToHttps]
+osx-10.12
+osx-10.13
+[putToHttpsSynchronous]
+osx-10.12
+osx-10.13
+[putWithRateLimiting]
+osx-10.12
+osx-10.13
+[qtbug13431replyThrottling]
+osx-10.12
+[receiveCookiesFromHttp]
+osx-10.12
+osx-10.13
+[receiveCookiesFromHttpSynchronous]
+osx-10.12
+osx-10.13
+[sendCookies]
+osx-10.12
+osx-10.13
+[sendCookiesSynchronous]
+osx-10.12
+osx-10.13
+[sendCustomRequestToHttp]
+osx-10.12
+[sslConfiguration]
+osx-10.12
+osx-10.13
+[synchronousRequest]
+osx-10.12
+osx-10.13
+[backgroundRequestConnectInBackground]
+osx-10.12
+osx-10.13
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 1afd8af7b0..418e1caf68 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -6426,7 +6426,8 @@ void tst_QNetworkReply::abortOnEncrypted()
QSKIP("Server fails to listen. Skipping since QTcpServer is covered in another test.");
server.connect(&server, &SslServer::newEncryptedConnection, [&server]() {
- connect(server.socket, &QTcpSocket::readyRead, server.socket, []() {
+ // MSVC 201X C4573-misunderstands connect() or QObject::connect(), so use server.connect():
+ server.connect(server.socket, &QTcpSocket::readyRead, server.socket, []() {
// This slot must not be invoked!
QVERIFY(false);
});
@@ -6474,8 +6475,8 @@ void tst_QNetworkReply::sslSessionSharing_data()
void tst_QNetworkReply::sslSessionSharing()
{
-#ifdef QT_SECURETRANSPORT
- QSKIP("Not implemented with SecureTransport");
+#if QT_CONFIG(schannel) || defined(QT_SECURETRANSPORT)
+ QSKIP("Not implemented with SecureTransport/Schannel");
#endif
QString urlString("https://" + QtNetworkSettings::httpServerName());
@@ -6542,8 +6543,8 @@ void tst_QNetworkReply::sslSessionSharingFromPersistentSession_data()
void tst_QNetworkReply::sslSessionSharingFromPersistentSession()
{
-#ifdef QT_SECURETRANSPORT
- QSKIP("Not implemented with SecureTransport");
+#if QT_CONFIG(schannel) || defined(QT_SECURETRANSPORT)
+ QSKIP("Not implemented with SecureTransport/Schannel");
#endif
QString urlString("https://" + QtNetworkSettings::httpServerName());
@@ -8200,6 +8201,9 @@ void tst_QNetworkReply::backgroundRequestInterruption_data()
void tst_QNetworkReply::backgroundRequestInterruption()
{
#ifndef QT_NO_BEARERMANAGEMENT
+ if (QNetworkStatusMonitor::isEnabled() && QByteArray(QTest::currentDataTag()).startsWith("http"))
+ QSKIP("This test (currently) doesn't make any sense when QNetworkStatusMonitor is enabled");
+
QFETCH(QUrl, url);
QFETCH(bool, background);
QFETCH(QNetworkReply::NetworkError, error);
diff --git a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp
index 7a3def410a..6637be0174 100644
--- a/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp
+++ b/tests/auto/network/access/qnetworkrequest/tst_qnetworkrequest.cpp
@@ -41,6 +41,7 @@ class tst_QNetworkRequest: public QObject
private slots:
void ctor_data();
void ctor();
+ void implicitDefaultCtor();
void setUrl_data();
void setUrl();
void setRawHeader_data();
@@ -78,6 +79,12 @@ void tst_QNetworkRequest::ctor()
}
}
+void tst_QNetworkRequest::implicitDefaultCtor()
+{
+ QNetworkRequest r = {};
+ Q_UNUSED(r);
+}
+
void tst_QNetworkRequest::setUrl_data()
{
ctor_data();
diff --git a/tests/auto/network/access/spdy/BLACKLIST b/tests/auto/network/access/spdy/BLACKLIST
index b13eae1000..ce2f7f383f 100644
--- a/tests/auto/network/access/spdy/BLACKLIST
+++ b/tests/auto/network/access/spdy/BLACKLIST
@@ -1,4 +1,10 @@
[download]
-linux
+opensuse-leap
+ubuntu-18.04
+ubuntu-16.04
+b2qt
[upload]
-linux
+opensuse-leap
+ubuntu-18.04
+b2qt
+
diff --git a/tests/auto/network/kernel/qdnslookup/BLACKLIST b/tests/auto/network/kernel/qdnslookup/BLACKLIST
index edf6436384..4461d8b5f7 100644
--- a/tests/auto/network/kernel/qdnslookup/BLACKLIST
+++ b/tests/auto/network/kernel/qdnslookup/BLACKLIST
@@ -1,2 +1,12 @@
[lookup]
-ci
+rhel-7.6
+opensuse-leap
+osx-10.13
+windows-7sp1
+ubuntu-18.04
+rhel-7.4
+b2qt
+windows-10 msvc-2017
+osx-10.12
+windows-10 msvc-2015
+opensuse-42.3
diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
index 224e4d61a9..48f05a4604 100644
--- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp
@@ -375,11 +375,14 @@ QT_WARNING_DISABLE_DEPRECATED
void tst_QHostAddress::assignment()
{
QHostAddress address;
+
+#if QT_DEPRECATED_SINCE(5, 8)
address = "127.0.0.1";
QCOMPARE(address, QHostAddress("127.0.0.1"));
address = "::1";
QCOMPARE(address, QHostAddress("::1"));
+#endif
// WinRT does not support sockaddr_in
#ifndef Q_OS_WINRT
diff --git a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
index da6e02210b..a603b2d879 100644
--- a/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/network/kernel/qhostinfo/tst_qhostinfo.cpp
@@ -92,6 +92,7 @@ private slots:
void lookupIPv6();
void lookupConnectToFunctionPointer_data();
void lookupConnectToFunctionPointer();
+ void lookupConnectToFunctionPointerDeleted();
void lookupConnectToLambda_data();
void lookupConnectToLambda();
void reverseLookup_data();
@@ -358,6 +359,17 @@ void tst_QHostInfo::lookupConnectToFunctionPointer()
QCOMPARE(tmp.join(' '), expected.join(' '));
}
+void tst_QHostInfo::lookupConnectToFunctionPointerDeleted()
+{
+ {
+ QObject contextObject;
+ QHostInfo::lookupHost("localhost", &contextObject, [](const QHostInfo){
+ QFAIL("This should never be called!");
+ });
+ }
+ QTestEventLoop::instance().enterLoop(3);
+}
+
void tst_QHostInfo::lookupConnectToLambda_data()
{
lookupIPv4_data();
@@ -464,7 +476,9 @@ void tst_QHostInfo::reverseLookup_data()
QTest::newRow("dns.google") << QString("8.8.8.8") << reverseLookupHelper("8.8.8.8") << 0 << false;
QTest::newRow("one.one.one.one") << QString("1.1.1.1") << reverseLookupHelper("1.1.1.1") << 0 << false;
- QTest::newRow("bogus-name") << QString("1::2::3::4") << QStringList() << 1 << true;
+ QTest::newRow("dns.google IPv6") << QString("2001:4860:4860::8888") << reverseLookupHelper("2001:4860:4860::8888") << 0 << true;
+ QTest::newRow("cloudflare IPv6") << QString("2606:4700:4700::1111") << reverseLookupHelper("2606:4700:4700::1111") << 0 << true;
+ QTest::newRow("bogus-name IPv6") << QString("1::2::3::4") << QStringList() << 1 << true;
}
void tst_QHostInfo::reverseLookup()
@@ -705,6 +719,7 @@ void tst_QHostInfo::cache()
void tst_QHostInfo::resultsReady(const QHostInfo &hi)
{
+ QVERIFY(QThread::currentThread() == thread());
lookupDone = true;
lookupResults = hi;
lookupsDoneCounter++;
diff --git a/tests/auto/network/socket/platformsocketengine/BLACKLIST b/tests/auto/network/socket/platformsocketengine/BLACKLIST
index 154c5cc5b2..f1f88d26d1 100644
--- a/tests/auto/network/socket/platformsocketengine/BLACKLIST
+++ b/tests/auto/network/socket/platformsocketengine/BLACKLIST
@@ -1,8 +1,11 @@
[tcpLoopbackPerformance]
-windows
+windows-10 msvc-2015
+windows-7sp1
[receiveUrgentData]
-windows
+windows-10 msvc-2015
+windows-7sp1
[serverTest]
-windows
+windows-10 msvc-2015
+windows-7sp1
[tcpLoopbackPerformance]
windows
diff --git a/tests/auto/network/socket/qhttpsocketengine/BLACKLIST b/tests/auto/network/socket/qhttpsocketengine/BLACKLIST
index 991d01dd00..ceb3b7862e 100644
--- a/tests/auto/network/socket/qhttpsocketengine/BLACKLIST
+++ b/tests/auto/network/socket/qhttpsocketengine/BLACKLIST
@@ -1,6 +1,5 @@
-[passwordAuth]
-windows
[downloadBigFile]
-windows
+windows-10 msvc-2015
+windows-7sp1
[ensureEofTriggersNotification]
windows
diff --git a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST
index 8af3cea8dc..f769aafbdd 100644
--- a/tests/auto/network/socket/qsocks5socketengine/BLACKLIST
+++ b/tests/auto/network/socket/qsocks5socketengine/BLACKLIST
@@ -1,11 +1,12 @@
[udpTest]
*
[passwordAuth]
-*
+ubuntu-18.04
# QTBUG-74162
[passwordAuth2]
-*
-[serverTest]
-windows
+osx-10.12
+ubuntu-18.04
[downloadBigFile]
-windows
+windows-10 msvc-2015
+windows-7sp1
+
diff --git a/tests/auto/network/socket/qtcpserver/BLACKLIST b/tests/auto/network/socket/qtcpserver/BLACKLIST
index f8b61808cc..ad0edf0af1 100644
--- a/tests/auto/network/socket/qtcpserver/BLACKLIST
+++ b/tests/auto/network/socket/qtcpserver/BLACKLIST
@@ -1,13 +1,24 @@
-windows
-[linkLocal]
-linux
+[listenWhileListening]
+windows-10 msvc-2015
[listenWhileListening:WithSocks5Proxy]
linux
windows
+[ipv6Server]
+windows-10 msvc-2015
+windows-7sp1
+windows-10 msvc-2017
[ipv6Server:WithoutProxy]
windows
osx
-[clientServerLoop:WithSocks5Proxy]
-linux
-[crashTests:WithSocks5Proxy]
-linux
+[addressReusable]
+windows-10 msvc-2015
+[eagainBlockingAccept]
+windows-10 msvc-2015
+windows-7sp1
+windows-10 msvc-2017
+[proxyFactory]
+windows-7sp1
+[serverAddress]
+windows-10 msvc-2017
+windows-10 msvc-2015
+windows-7sp1
diff --git a/tests/auto/network/socket/qtcpsocket/BLACKLIST b/tests/auto/network/socket/qtcpsocket/BLACKLIST
index d724897b74..8c2f8d2638 100644
--- a/tests/auto/network/socket/qtcpsocket/BLACKLIST
+++ b/tests/auto/network/socket/qtcpsocket/BLACKLIST
@@ -1,13 +1,14 @@
-[bindThenResolveHost:first-fail]
-windows
+[bind]
+windows-10 msvc-2015
+windows-7sp1
[bind:[::]]
windows
[bind:[::]:randomport]
windows
-[invalidProxy:socks5-on-http]
-windows
+[timeoutConnect]
+windows-10 msvc-2015
+# QTBUG-66247
[timeoutConnect:ip]
windows
# QTBUG-66247
-[taskQtBug5799ConnectionErrorEventLoop]
-windows
+
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 7733b0a62b..75b9b23259 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -164,9 +164,8 @@ private slots:
void waitForReadyReadInASlot();
void remoteCloseError();
void nestedEventLoopInErrorSlot();
-#ifndef Q_OS_WIN
- void connectToLocalHostNoService();
-#endif
+ void connectToHostError_data();
+ void connectToHostError();
void waitForConnectedInHostLookupSlot();
void waitForConnectedInHostLookupSlot2();
void readyReadSignalsAfterWaitForReadyRead();
@@ -2066,18 +2065,38 @@ void tst_QTcpSocket::nestedEventLoopInErrorSlot()
}
//----------------------------------------------------------------------------------
-#ifndef Q_OS_WIN
-void tst_QTcpSocket::connectToLocalHostNoService()
+
+void tst_QTcpSocket::connectToHostError_data()
+{
+ QTest::addColumn<QString>("host");
+ QTest::addColumn<int>("port");
+ QTest::addColumn<QAbstractSocket::SocketError>("expectedError");
+
+ QTest::newRow("localhost no service") << QStringLiteral("localhost") << 31415 << QAbstractSocket::ConnectionRefusedError;
+ QTest::newRow("unreachable") << QStringLiteral("0.0.0.1") << 65000 << QAbstractSocket::NetworkError;
+}
+
+
+void tst_QTcpSocket::connectToHostError()
{
- // This test was created after we received a report that claimed
- // QTcpSocket would crash if trying to connect to "localhost" on a random
- // port with no service listening.
QTcpSocket *socket = newSocket();
- socket->connectToHost("localhost", 31415); // no service running here, one suspects
+
+ QAbstractSocket::SocketError error = QAbstractSocket::UnknownSocketError;
+
+ QFETCH(QString, host);
+ QFETCH(int, port);
+ QFETCH(QAbstractSocket::SocketError, expectedError);
+
+ connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),[&](QAbstractSocket::SocketError socketError){
+ error = socketError;
+ });
+ socket->connectToHost(host, port); // no service running here, one suspects
QTRY_COMPARE(socket->state(), QTcpSocket::UnconnectedState);
+ if (error != expectedError && error == QAbstractSocket::ConnectionRefusedError)
+ QEXPECT_FAIL("unreachable", "CI firewall interfers with this test", Continue);
+ QCOMPARE(error, expectedError);
delete socket;
}
-#endif
//----------------------------------------------------------------------------------
void tst_QTcpSocket::waitForConnectedInHostLookupSlot()
diff --git a/tests/auto/network/socket/qudpsocket/BLACKLIST b/tests/auto/network/socket/qudpsocket/BLACKLIST
index 0d56f6c827..9b5aa8a3fc 100644
--- a/tests/auto/network/socket/qudpsocket/BLACKLIST
+++ b/tests/auto/network/socket/qudpsocket/BLACKLIST
@@ -1,26 +1,16 @@
[writeDatagramToNonExistingPeer]
-windows
-osx
-[asyncReadDatagram]
-osx
+windows-10 msvc-2017
+windows-10 msvc-2015
+windows-7sp1
[multicastLeaveAfterClose]
-osx
-[readyRead]
-osx
+osx-10.12
+osx-10.11
[readyReadForEmptyDatagram]
-osx
+opensuse-leap
+ubuntu-16.04
[echo]
-linux
-osx
+opensuse-42.3
[ipv6Loop]
-osx
-[loop]
-osx
-[broadcasting]
-osx
-[zeroLengthDatagram]
-osx
-[linkLocalIPv6]
-linux
+osx-10.12
[readyReadForEmptyDatagram]
linux
diff --git a/tests/auto/network/socket/qudpsocket/clientserver/main.cpp b/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
index cc3e90671a..8172cd4f6f 100644
--- a/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
+++ b/tests/auto/network/socket/qudpsocket/clientserver/main.cpp
@@ -54,7 +54,7 @@ public:
printf("ok\n");
break;
case UnconnectedClient:
- peerAddress = host;
+ peerAddress = QHostAddress(host);
peerPort = port;
if (bind(QHostAddress::Any, port + 1, ShareAddress | ReuseAddressHint)) {
startTimer(250);
diff --git a/tests/auto/network/ssl/qsslcertificate/BLACKLIST b/tests/auto/network/ssl/qsslcertificate/BLACKLIST
index 25509a5ca8..9494ee2278 100644
--- a/tests/auto/network/ssl/qsslcertificate/BLACKLIST
+++ b/tests/auto/network/ssl/qsslcertificate/BLACKLIST
@@ -1,3 +1,13 @@
# OpenSSL version is too new. Rich will fix :)
[subjectAndIssuerAttributes]
-*
+ubuntu-16.04
+rhel-7.6
+opensuse-leap
+windows-7sp1
+ubuntu-18.04
+rhel-7.4
+b2qt
+windows-10 msvc-2017
+windows-10 msvc-2015
+opensuse-42.3
+
diff --git a/tests/auto/network/ssl/qsslkey/BLACKLIST b/tests/auto/network/ssl/qsslkey/BLACKLIST
index f9bc0af6de..e9723001f5 100644
--- a/tests/auto/network/ssl/qsslkey/BLACKLIST
+++ b/tests/auto/network/ssl/qsslkey/BLACKLIST
@@ -1,2 +1,16 @@
-redhatenterpriselinuxworkstation
-rhel
+[constructor]
+rhel-6.6
+rhel-7.4
+rhel-7.6
+[length]
+rhel-6.6
+rhel-7.4
+rhel-7.6
+[toEncryptedPemOrDer]
+rhel-6.6
+rhel-7.4
+rhel-7.6
+[toPemOrDer]
+rhel-6.6
+rhel-7.4
+rhel-7.6
diff --git a/tests/auto/network/ssl/qsslsocket/BLACKLIST b/tests/auto/network/ssl/qsslsocket/BLACKLIST
index 3ecd3d9dbb..36143691c9 100644
--- a/tests/auto/network/ssl/qsslsocket/BLACKLIST
+++ b/tests/auto/network/ssl/qsslsocket/BLACKLIST
@@ -1,23 +1,15 @@
[abortOnSslErrors]
-windows
+windows-10 msvc-2015
[deprecatedProtocols]
windows
-[disabledProtocols]
-windows
-[protocol]
-windows
-[qtbug18498_peek]
-windows
-[setReadBufferSize]
-windows
[spontaneousWrite]
-windows
+windows-7sp1
[sslErrors]
-windows
+windows-7sp1
[connectToHostEncrypted]
osx-10.13
[setSslConfiguration]
-windows
-osx-10.13
+windows-10 msvc-2015
+windows-7sp1
[connectToHostEncryptedWithVerificationPeerName]
osx-10.13
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 4035dfbf5f..4e02320362 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -546,6 +546,7 @@ void tst_QSslSocket::constructing()
// verify that changing the default config doesn't affect this socket
// (on Unix, the ca certs might be empty, depending on whether we load
// them on demand or not, so set them explicitly)
+#if QT_DEPRECATED_SINCE(5, 5)
socket.setCaCertificates(QSslSocket::systemCaCertificates());
QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>());
QSslSocket::setDefaultCiphers(QList<QSslCipher>());
@@ -557,6 +558,25 @@ void tst_QSslSocket::constructing()
QVERIFY(QSslConfiguration::defaultConfiguration().ciphers().isEmpty());
QSslConfiguration::setDefaultConfiguration(savedDefault);
+#endif
+
+ auto sslConfig = socket.sslConfiguration();
+ sslConfig.setCaCertificates(QSslConfiguration::systemCaCertificates());
+ socket.setSslConfiguration(sslConfig);
+
+ auto defaultConfig = QSslConfiguration::defaultConfiguration();
+ defaultConfig.setCaCertificates(QList<QSslCertificate>());
+ defaultConfig.setCiphers(QList<QSslCipher>());
+ QSslConfiguration::setDefaultConfiguration(defaultConfig);
+
+ QVERIFY(!socket.sslConfiguration().caCertificates().isEmpty());
+ QVERIFY(!socket.sslConfiguration().ciphers().isEmpty());
+
+ // verify the default as well:
+ QVERIFY(QSslConfiguration::defaultConfiguration().caCertificates().isEmpty());
+ QVERIFY(QSslConfiguration::defaultConfiguration().ciphers().isEmpty());
+
+ QSslConfiguration::setDefaultConfiguration(savedDefault);
}
void tst_QSslSocket::simpleConnect()
@@ -756,18 +776,41 @@ void tst_QSslSocket::ciphers()
{
if (!QSslSocket::supportsSsl())
return;
-
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QSslSocket socket;
+ QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
+ socket.setCiphers(QList<QSslCipher>());
+ QVERIFY(socket.ciphers().isEmpty());
+ socket.setCiphers(socket.defaultCiphers());
+ QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
+ socket.setCiphers(socket.defaultCiphers());
+ QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
+
+ // Task 164356
+ socket.setCiphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
+ }
+#endif
QSslSocket socket;
- QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
- socket.setCiphers(QList<QSslCipher>());
- QVERIFY(socket.ciphers().isEmpty());
- socket.setCiphers(socket.defaultCiphers());
- QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
- socket.setCiphers(socket.defaultCiphers());
- QCOMPARE(socket.ciphers(), QSslSocket::defaultCiphers());
+ QCOMPARE(socket.sslConfiguration().ciphers(), QSslConfiguration::defaultConfiguration().ciphers());
+
+ auto sslConfig = socket.sslConfiguration();
+ sslConfig.setCiphers(QList<QSslCipher>());
+ socket.setSslConfiguration(sslConfig);
+ QVERIFY(socket.sslConfiguration().ciphers().isEmpty());
+
+ sslConfig.setCiphers(QSslConfiguration::defaultConfiguration().ciphers());
+ socket.setSslConfiguration(sslConfig);
+ QCOMPARE(socket.sslConfiguration().ciphers(), QSslConfiguration::defaultConfiguration().ciphers());
+
+ sslConfig.setCiphers(QSslConfiguration::defaultConfiguration().ciphers());
+ socket.setSslConfiguration(sslConfig);
+ QCOMPARE(socket.sslConfiguration().ciphers(), QSslConfiguration::defaultConfiguration().ciphers());
// Task 164356
- socket.setCiphers("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
+ sslConfig.setCiphers({QSslCipher("ALL"), QSslCipher("!ADH"), QSslCipher("!LOW"),
+ QSslCipher("!EXP"), QSslCipher("!MD5"), QSslCipher("@STRENGTH")});
+ socket.setSslConfiguration(sslConfig);
}
void tst_QSslSocket::connectToHostEncrypted()
@@ -858,11 +901,14 @@ void tst_QSslSocket::sessionCipher()
QSKIP("Skipping flaky test - See QTBUG-29941");
QVERIFY(!socket->sessionCipher().isNull());
- qDebug() << "Supported Ciphers:" << QSslSocket::supportedCiphers();
- qDebug() << "Default Ciphers:" << QSslSocket::defaultCiphers();
+ qDebug() << "Supported Ciphers:" << QSslConfiguration::supportedCiphers();
+ qDebug() << "Default Ciphers:" << QSslConfiguration::defaultConfiguration().ciphers();
qDebug() << "Session Cipher:" << socket->sessionCipher();
+#if QT_DEPRECATED_SINCE(5, 5)
QVERIFY(QSslSocket::supportedCiphers().contains(socket->sessionCipher()));
+#endif
+ QVERIFY(QSslConfiguration::supportedCiphers().contains(socket->sessionCipher()));
socket->disconnectFromHost();
QVERIFY(socket->waitForDisconnected());
}
@@ -886,7 +932,11 @@ void tst_QSslSocket::localCertificate()
QSslSocketPtr socket = newSocket();
QList<QSslCertificate> localCert = QSslCertificate::fromPath(httpServerCertChainPath());
- socket->setCaCertificates(localCert);
+
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCaCertificates(localCert);
+ socket->setSslConfiguration(sslConfig);
+
socket->setLocalCertificate(testDataDir + "certs/fluke.cert");
socket->setPrivateKey(testDataDir + "certs/fluke.key");
@@ -990,7 +1040,11 @@ void tst_QSslSocket::privateKeyOpaque()
QSslSocketPtr socket = newSocket();
QList<QSslCertificate> localCert = QSslCertificate::fromPath(httpServerCertChainPath());
- socket->setCaCertificates(localCert);
+
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCaCertificates(localCert);
+ socket->setSslConfiguration(sslConfig);
+
socket->setLocalCertificate(testDataDir + "certs/fluke.cert");
socket->setPrivateKey(QSslKey(reinterpret_cast<Qt::HANDLE>(pkey)));
@@ -1011,7 +1065,10 @@ void tst_QSslSocket::protocol()
this->socket = socket.data();
QList<QSslCertificate> certs = QSslCertificate::fromPath(httpServerCertChainPath());
- socket->setCaCertificates(certs);
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCaCertificates(certs);
+ socket->setSslConfiguration(sslConfig);
+
#ifdef QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(untrustedWorkaroundSlot(QList<QSslError>)));
@@ -1159,7 +1216,7 @@ public:
QString m_keyFile;
QString m_certFile;
QString m_interFile;
- QString ciphers;
+ QList<QSslCipher> ciphers;
signals:
void socketError(QAbstractSocket::SocketError);
@@ -1209,7 +1266,9 @@ protected:
}
if (!ciphers.isEmpty()) {
- socket->setCiphers(ciphers);
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCiphers(ciphers);
+ socket->setSslConfiguration(sslConfig);
}
QVERIFY(socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState));
@@ -1359,7 +1418,7 @@ void tst_QSslSocket::serverCipherPreferences()
// First using the default (server preference)
{
SslServer server;
- server.ciphers = QString("AES128-SHA:AES256-SHA");
+ server.ciphers = {QSslCipher("AES128-SHA"), QSslCipher("AES256-SHA")};
QVERIFY(server.listen());
QEventLoop loop;
@@ -1367,7 +1426,10 @@ void tst_QSslSocket::serverCipherPreferences()
QSslSocket client;
socket = &client;
- socket->setCiphers("AES256-SHA:AES128-SHA");
+
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
+ socket->setSslConfiguration(sslConfig);
// upon SSL wrong version error, error will be triggered, not sslErrors
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
@@ -1388,7 +1450,7 @@ void tst_QSslSocket::serverCipherPreferences()
QSslConfiguration config = QSslConfiguration::defaultConfiguration();
config.setSslOption(QSsl::SslOptionDisableServerCipherPreference, true);
server.config = config;
- server.ciphers = QString("AES128-SHA:AES256-SHA");
+ server.ciphers = {QSslCipher("AES128-SHA"), QSslCipher("AES256-SHA")};
QVERIFY(server.listen());
QEventLoop loop;
@@ -1396,7 +1458,10 @@ void tst_QSslSocket::serverCipherPreferences()
QSslSocket client;
socket = &client;
- socket->setCiphers("AES256-SHA:AES128-SHA");
+
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
+ socket->setSslConfiguration(sslConfig);
// upon SSL wrong version error, error will be triggered, not sslErrors
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
@@ -1420,12 +1485,30 @@ void tst_QSslSocket::setCaCertificates()
if (!QSslSocket::supportsSsl())
return;
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QSslSocket socket;
+ QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates());
+ socket.setCaCertificates(QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"));
+ QCOMPARE(socket.caCertificates().size(), 1);
+ socket.setCaCertificates(socket.defaultCaCertificates());
+ QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates());
+ }
+#endif
QSslSocket socket;
- QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates());
- socket.setCaCertificates(QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"));
- QCOMPARE(socket.caCertificates().size(), 1);
- socket.setCaCertificates(socket.defaultCaCertificates());
- QCOMPARE(socket.caCertificates(), QSslSocket::defaultCaCertificates());
+ QCOMPARE(socket.sslConfiguration().caCertificates(),
+ QSslConfiguration::defaultConfiguration().caCertificates());
+
+ auto sslConfig = socket.sslConfiguration();
+ sslConfig.setCaCertificates(
+ QSslCertificate::fromPath(testDataDir + "certs/qt-test-server-cacert.pem"));
+ socket.setSslConfiguration(sslConfig);
+ QCOMPARE(socket.sslConfiguration().caCertificates().size(), 1);
+
+ sslConfig.setCaCertificates(QSslConfiguration::defaultConfiguration().caCertificates());
+ socket.setSslConfiguration(sslConfig);
+ QCOMPARE(socket.sslConfiguration().caCertificates(),
+ QSslConfiguration::defaultConfiguration().caCertificates());
}
void tst_QSslSocket::setLocalCertificate()
@@ -1638,19 +1721,43 @@ void tst_QSslSocket::addDefaultCaCertificate()
if (!QSslSocket::supportsSsl())
return;
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ // Reset the global CA chain
+ QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+
+ QList<QSslCertificate> flukeCerts = QSslCertificate::fromPath(httpServerCertChainPath());
+ QCOMPARE(flukeCerts.size(), 1);
+ QList<QSslCertificate> globalCerts = QSslSocket::defaultCaCertificates();
+ QVERIFY(!globalCerts.contains(flukeCerts.first()));
+ QSslSocket::addDefaultCaCertificate(flukeCerts.first());
+ QCOMPARE(QSslSocket::defaultCaCertificates().size(), globalCerts.size() + 1);
+ QVERIFY(QSslSocket::defaultCaCertificates().contains(flukeCerts.first()));
+
+ // Restore the global CA chain
+ QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+ }
+#endif
+
// Reset the global CA chain
- QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+ auto sslConfig = QSslConfiguration::defaultConfiguration();
+ sslConfig.setCaCertificates(QSslConfiguration::systemCaCertificates());
+ QSslConfiguration::setDefaultConfiguration(sslConfig);
QList<QSslCertificate> flukeCerts = QSslCertificate::fromPath(httpServerCertChainPath());
QCOMPARE(flukeCerts.size(), 1);
- QList<QSslCertificate> globalCerts = QSslSocket::defaultCaCertificates();
+ QList<QSslCertificate> globalCerts = QSslConfiguration::defaultConfiguration().caCertificates();
QVERIFY(!globalCerts.contains(flukeCerts.first()));
QSslSocket::addDefaultCaCertificate(flukeCerts.first());
- QCOMPARE(QSslSocket::defaultCaCertificates().size(), globalCerts.size() + 1);
- QVERIFY(QSslSocket::defaultCaCertificates().contains(flukeCerts.first()));
+ QCOMPARE(QSslConfiguration::defaultConfiguration().caCertificates().size(),
+ globalCerts.size() + 1);
+ QVERIFY(QSslConfiguration::defaultConfiguration().caCertificates()
+ .contains(flukeCerts.first()));
// Restore the global CA chain
- QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+ sslConfig = QSslConfiguration::defaultConfiguration();
+ sslConfig.setCaCertificates(QSslConfiguration::systemCaCertificates());
+ QSslConfiguration::setDefaultConfiguration(sslConfig);
}
void tst_QSslSocket::addDefaultCaCertificates()
@@ -1666,9 +1773,16 @@ void tst_QSslSocket::defaultCaCertificates()
if (!QSslSocket::supportsSsl())
return;
- QList<QSslCertificate> certs = QSslSocket::defaultCaCertificates();
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QList<QSslCertificate> certs = QSslSocket::defaultCaCertificates();
+ QVERIFY(certs.size() > 1);
+ QCOMPARE(certs, QSslSocket::systemCaCertificates());
+ }
+#endif
+ QList<QSslCertificate> certs = QSslConfiguration::defaultConfiguration().caCertificates();
QVERIFY(certs.size() > 1);
- QCOMPARE(certs, QSslSocket::systemCaCertificates());
+ QCOMPARE(certs, QSslConfiguration::systemCaCertificates());
}
void tst_QSslSocket::defaultCiphers()
@@ -1676,12 +1790,22 @@ void tst_QSslSocket::defaultCiphers()
if (!QSslSocket::supportsSsl())
return;
- QList<QSslCipher> ciphers = QSslSocket::defaultCiphers();
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QList<QSslCipher> ciphers = QSslSocket::defaultCiphers();
+ QVERIFY(ciphers.size() > 1);
+
+ QSslSocket socket;
+ QCOMPARE(socket.defaultCiphers(), ciphers);
+ QCOMPARE(socket.ciphers(), ciphers);
+ }
+#endif
+ QList<QSslCipher> ciphers = QSslConfiguration::defaultConfiguration().ciphers();
QVERIFY(ciphers.size() > 1);
QSslSocket socket;
- QCOMPARE(socket.defaultCiphers(), ciphers);
- QCOMPARE(socket.ciphers(), ciphers);
+ QCOMPARE(socket.sslConfiguration().defaultConfiguration().ciphers(), ciphers);
+ QCOMPARE(socket.sslConfiguration().ciphers(), ciphers);
}
void tst_QSslSocket::resetDefaultCiphers()
@@ -1701,11 +1825,21 @@ void tst_QSslSocket::supportedCiphers()
if (!QSslSocket::supportsSsl())
return;
- QList<QSslCipher> ciphers = QSslSocket::supportedCiphers();
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QList<QSslCipher> ciphers = QSslSocket::supportedCiphers();
+ QVERIFY(ciphers.size() > 1);
+
+ QSslSocket socket;
+ QCOMPARE(socket.supportedCiphers(), ciphers);
+ }
+#endif
+
+ QList<QSslCipher> ciphers = QSslConfiguration::supportedCiphers();
QVERIFY(ciphers.size() > 1);
QSslSocket socket;
- QCOMPARE(socket.supportedCiphers(), ciphers);
+ QCOMPARE(socket.sslConfiguration().supportedCiphers(), ciphers);
}
void tst_QSslSocket::systemCaCertificates()
@@ -1713,9 +1847,16 @@ void tst_QSslSocket::systemCaCertificates()
if (!QSslSocket::supportsSsl())
return;
- QList<QSslCertificate> certs = QSslSocket::systemCaCertificates();
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ QList<QSslCertificate> certs = QSslSocket::systemCaCertificates();
+ QVERIFY(certs.size() > 1);
+ QCOMPARE(certs, QSslSocket::defaultCaCertificates());
+ }
+#endif
+ QList<QSslCertificate> certs = QSslConfiguration::systemCaCertificates();
QVERIFY(certs.size() > 1);
- QCOMPARE(certs, QSslSocket::defaultCaCertificates());
+ QCOMPARE(certs, QSslConfiguration::defaultConfiguration().systemCaCertificates());
}
void tst_QSslSocket::wildcardCertificateNames()
@@ -2755,7 +2896,6 @@ void tst_QSslSocket::encryptWithoutConnecting()
void tst_QSslSocket::resume_data()
{
- QSKIP("Temporary skip while updating certificates");
QTest::addColumn<bool>("ignoreErrorsAfterPause");
QTest::addColumn<QList<QSslError> >("errorsToIgnore");
QTest::addColumn<bool>("expectSuccess");
@@ -2780,7 +2920,9 @@ void tst_QSslSocket::resume()
{
// make sure the server certificate is not in the list of accepted certificates,
// we want to trigger the sslErrors signal
- QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+ auto sslConfig = QSslConfiguration::defaultConfiguration();
+ sslConfig.setCaCertificates(QSslConfiguration::systemCaCertificates());
+ QSslConfiguration::setDefaultConfiguration(sslConfig);
QFETCH(bool, ignoreErrorsAfterPause);
QFETCH(QList<QSslError>, errorsToIgnore);
@@ -3100,7 +3242,7 @@ void tst_QSslSocket::dhServer()
return;
SslServer server;
- server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+ server.ciphers = {QSslCipher("DHE-RSA-AES256-SHA"), QSslCipher("DHE-DSS-AES256-SHA")};
QVERIFY(server.listen());
QEventLoop loop;
@@ -3129,7 +3271,7 @@ void tst_QSslSocket::dhServerCustomParamsNull()
return;
SslServer server;
- server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+ server.ciphers = {QSslCipher("DHE-RSA-AES256-SHA"), QSslCipher("DHE-DSS-AES256-SHA")};
QSslConfiguration cfg = server.config;
cfg.setDiffieHellmanParameters(QSslDiffieHellmanParameters());
@@ -3165,7 +3307,7 @@ void tst_QSslSocket::dhServerCustomParams()
return;
SslServer server;
- server.ciphers = QLatin1String("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA");
+ server.ciphers = {QSslCipher("DHE-RSA-AES256-SHA"), QSslCipher("DHE-DSS-AES256-SHA")};
QSslConfiguration cfg = server.config;
@@ -3214,7 +3356,7 @@ void tst_QSslSocket::ecdhServer()
return;
SslServer server;
- server.ciphers = QLatin1String("ECDHE-RSA-AES128-SHA");
+ server.ciphers = {QSslCipher("ECDHE-RSA-AES128-SHA")};
QVERIFY(server.listen());
QEventLoop loop;
@@ -3584,7 +3726,7 @@ public:
bool ignoreSslErrors;
QSslSocket::PeerVerifyMode peerVerifyMode;
QSsl::SslProtocol protocol;
- QString ciphers;
+ QList<QSslCipher> ciphers;
PskProvider m_pskProvider;
protected:
@@ -3598,7 +3740,9 @@ protected:
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
if (!ciphers.isEmpty()) {
- socket->setCiphers(ciphers);
+ auto sslConfig = socket->sslConfiguration();
+ sslConfig.setCiphers(ciphers);
+ socket->setSslConfiguration(sslConfig);
}
QVERIFY(socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState));
@@ -3640,7 +3784,7 @@ void tst_QSslSocket::simplePskConnect()
QSKIP("No SSL support");
bool pskCipherFound = false;
- const QList<QSslCipher> supportedCiphers = QSslSocket::supportedCiphers();
+ const QList<QSslCipher> supportedCiphers = QSslConfiguration::supportedCiphers();
for (const QSslCipher &cipher : supportedCiphers) {
if (cipher.name() == PSK_CIPHER_WITHOUT_AUTH) {
pskCipherFound = true;
@@ -3692,7 +3836,9 @@ void tst_QSslSocket::simplePskConnect()
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
// force a PSK cipher w/o auth
- socket.setCiphers(PSK_CIPHER_WITHOUT_AUTH);
+ auto sslConfig = socket.sslConfiguration();
+ sslConfig.setCiphers({QSslCipher(PSK_CIPHER_WITHOUT_AUTH)});
+ socket.setSslConfiguration(sslConfig);
PskProvider provider;
@@ -3961,7 +4107,9 @@ void tst_QSslSocket::pskServer()
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
// force a PSK cipher w/o auth
- socket.setCiphers(PSK_CIPHER_WITHOUT_AUTH);
+ auto sslConfig = socket.sslConfiguration();
+ sslConfig.setCiphers({QSslCipher(PSK_CIPHER_WITHOUT_AUTH)});
+ socket.setSslConfiguration(sslConfig);
PskProvider provider;
provider.setIdentity(PSK_CLIENT_IDENTITY);
diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
index 4199c0f465..3b28e7a803 100644
--- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
+++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
@@ -211,10 +211,23 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
{
const QString host("www.qt.io");
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ // not using any root certs -> should not work
+ QSslSocketPtr socket2 = newSocket();
+ this->socket = socket2.data();
+ socket2->setCaCertificates(QList<QSslCertificate>());
+ socket2->connectToHostEncrypted(host, 443);
+ QVERIFY(!waitForEncrypted(socket2.data()));
+ }
+#endif
+
// not using any root certs -> should not work
QSslSocketPtr socket2 = newSocket();
this->socket = socket2.data();
- socket2->setCaCertificates(QList<QSslCertificate>());
+ auto sslConfig = socket2->sslConfiguration();
+ sslConfig.setCaCertificates(QList<QSslCertificate>());
+ socket2->setSslConfiguration(sslConfig);
socket2->connectToHostEncrypted(host, 443);
QVERIFY(!waitForEncrypted(socket2.data()));
@@ -224,10 +237,23 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
socket->connectToHostEncrypted(host, 443);
QVERIFY2(waitForEncrypted(socket.data()), qPrintable(socket->errorString()));
+#if QT_DEPRECATED_SINCE(5, 5)
+ {
+ // not using any root certs again -> should not work
+ QSslSocketPtr socket3 = newSocket();
+ this->socket = socket3.data();
+ socket3->setCaCertificates(QList<QSslCertificate>());
+ socket3->connectToHostEncrypted(host, 443);
+ QVERIFY(!waitForEncrypted(socket3.data()));
+ }
+#endif
+
// not using any root certs again -> should not work
QSslSocketPtr socket3 = newSocket();
this->socket = socket3.data();
- socket3->setCaCertificates(QList<QSslCertificate>());
+ sslConfig = socket3->sslConfiguration();
+ sslConfig.setCaCertificates(QList<QSslCertificate>());
+ socket3->setSslConfiguration(sslConfig);
socket3->connectToHostEncrypted(host, 443);
QVERIFY(!waitForEncrypted(socket3.data()));
diff --git a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
index 671a21b1c2..a441d13619 100644
--- a/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
+++ b/tests/auto/network/ssl/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
@@ -178,6 +178,7 @@ void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMe
{
QString host("www.qt.io");
+#if QT_DEPRECATED_SINCE(5, 5)
// not using any root certs -> should not work
QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>());
QSslSocketPtr socket = newSocket();
@@ -200,6 +201,7 @@ void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMe
QVERIFY(!socket3->waitForEncrypted());
QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+#endif
// setting empty default configuration -> should not work
QSslConfiguration conf;