Add network-helpers.h file, similar to the shared network-settings.h
This is to place some special functionality we need on particular platforms, like peculiar case of TLS working in a special way on macOS. We previously updated our ST backend to use new properties when importing a key, but it's possible to run a test on macOS 15 that was build with older SDK which would still hit the old case with keychain access dialog. Change-Id: I3c893d6a3ec199be59104921db7a56b87c62a825 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 02e89640536b59ba299a819d96e97f83e156685f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4408d077ac
commit
97d342f0c4
29
tests/auto/network-helpers.h
Normal file
29
tests/auto/network-helpers.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (C) 2024 The Qt Company Ltd.
|
||||||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||||
|
|
||||||
|
#include <QtCore/qsystemdetection.h>
|
||||||
|
|
||||||
|
namespace QtNetworkTestHelpers
|
||||||
|
{
|
||||||
|
|
||||||
|
bool isSecureTransportBlockingTest()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
#if QT_MACOS_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(150000, 180000)
|
||||||
|
// Starting from macOS 15 our temporary keychain is ignored.
|
||||||
|
// We have to use kSecImportToMemoryOnly/kCFBooleanTrue key/value
|
||||||
|
// instead. This way we don't have to use QT_SSL_USE_TEMPORARY_KEYCHAIN anymore.
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSSequoia) {
|
||||||
|
// We were built with SDK below 15, but a file-based keychains are not working anymore on macOS 15...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // Q_OS_MACOS
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -84,6 +84,7 @@ Q_DECLARE_METATYPE(QSharedPointer<char>)
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "../../../network-settings.h"
|
#include "../../../network-settings.h"
|
||||||
|
#include "../../../network-helpers.h"
|
||||||
|
|
||||||
#ifdef Q_OS_INTEGRITY
|
#ifdef Q_OS_INTEGRITY
|
||||||
#include "qplatformdefs.h"
|
#include "qplatformdefs.h"
|
||||||
@ -5657,6 +5658,9 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
|
|||||||
QFETCH(bool, https);
|
QFETCH(bool, https);
|
||||||
QFETCH(int, bufferSize);
|
QFETCH(int, bufferSize);
|
||||||
|
|
||||||
|
if (https && QtNetworkTestHelpers::isSecureTransportBlockingTest())
|
||||||
|
QSKIP("SecureTransport: temporary keychain is not working on this version of macOS");
|
||||||
|
|
||||||
QByteArray testData;
|
QByteArray testData;
|
||||||
// Make the data big enough so that it can fill the kernel buffer
|
// Make the data big enough so that it can fill the kernel buffer
|
||||||
// (which seems to hold 202 KB here)
|
// (which seems to hold 202 KB here)
|
||||||
@ -6418,6 +6422,9 @@ void tst_QNetworkReply::httpProxyCommands_data()
|
|||||||
<< QByteArray("HTTP/1.0 200 OK\r\nProxy-Connection: close\r\nContent-Length: 1\r\n\r\n1")
|
<< QByteArray("HTTP/1.0 200 OK\r\nProxy-Connection: close\r\nContent-Length: 1\r\n\r\n1")
|
||||||
<< "GET http://0.0.0.0:4443/http-request HTTP/1.";
|
<< "GET http://0.0.0.0:4443/http-request HTTP/1.";
|
||||||
#if QT_CONFIG(ssl)
|
#if QT_CONFIG(ssl)
|
||||||
|
if (QtNetworkTestHelpers::isSecureTransportBlockingTest())
|
||||||
|
QSKIP("SecureTransport: temporary keychain is not working on this version of macOS");
|
||||||
|
|
||||||
QTest::newRow("https")
|
QTest::newRow("https")
|
||||||
<< QUrl("https://0.0.0.0:4443/https-request")
|
<< QUrl("https://0.0.0.0:4443/https-request")
|
||||||
<< QByteArray("HTTP/1.0 200 Connection Established\r\n\r\n")
|
<< QByteArray("HTTP/1.0 200 Connection Established\r\n\r\n")
|
||||||
@ -6644,8 +6651,10 @@ void tst_QNetworkReply::httpConnectionCount_data()
|
|||||||
QTest::addRow("http/1.1") << false << false;
|
QTest::addRow("http/1.1") << false << false;
|
||||||
QTest::addRow("http/2") << true << false;
|
QTest::addRow("http/2") << true << false;
|
||||||
#if QT_CONFIG(ssl)
|
#if QT_CONFIG(ssl)
|
||||||
QTest::addRow("https/1.1") << false << true;
|
if (!QtNetworkTestHelpers::isSecureTransportBlockingTest()) {
|
||||||
QTest::addRow("https/2") << true << true;
|
QTest::addRow("https/1.1") << false << true;
|
||||||
|
QTest::addRow("https/2") << true << true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7004,6 +7013,9 @@ void tst_QNetworkReply::encrypted()
|
|||||||
|
|
||||||
void tst_QNetworkReply::abortOnEncrypted()
|
void tst_QNetworkReply::abortOnEncrypted()
|
||||||
{
|
{
|
||||||
|
if (QtNetworkTestHelpers::isSecureTransportBlockingTest())
|
||||||
|
QSKIP("SecureTransport: temporary keychain is not working on this version of macOS");
|
||||||
|
|
||||||
SslServer server;
|
SslServer server;
|
||||||
server.listen();
|
server.listen();
|
||||||
if (!server.isListening())
|
if (!server.isListening())
|
||||||
@ -9842,6 +9854,9 @@ public slots:
|
|||||||
|
|
||||||
void tst_QNetworkReply::putWithServerClosingConnectionImmediately()
|
void tst_QNetworkReply::putWithServerClosingConnectionImmediately()
|
||||||
{
|
{
|
||||||
|
if (QtNetworkTestHelpers::isSecureTransportBlockingTest())
|
||||||
|
QSKIP("SecureTransport: temporary keychain is not working on this version of macOS");
|
||||||
|
|
||||||
const int numUploads = 40;
|
const int numUploads = 40;
|
||||||
qint64 wantedSize = 512*1024; // 512 kB
|
qint64 wantedSize = 512*1024; // 512 kB
|
||||||
QByteArray sourceFile;
|
QByteArray sourceFile;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user