QNetworkAccessManager: deprecate bearer related functions

In Qt6 QNAM will no longer use bearer in any way so we deprecate it now.

Also mark bearermanagement-conditioned sections for removal in Qt6,
the _q_networksession property is part of how QNAM passes the
QNetworkSession around.

Task-number: QTBUG-81609
Change-Id: I04aad9dd96482c6822dffba1b9af7aa58961149c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Mårten Nordheim 2020-01-27 16:34:53 +01:00
parent 4df303ece7
commit 7321a2c624
22 changed files with 100 additions and 78 deletions

View File

@ -317,7 +317,7 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
socket = nullptr; socket = nullptr;
} }
socket = new QTcpSocket(this); socket = new QTcpSocket(this);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket //copy network session down to the socket
socket->setProperty("_q_networksession", property("_q_networksession")); socket->setProperty("_q_networksession", property("_q_networksession"));
#endif #endif
@ -333,7 +333,7 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
int QFtpDTP::setupListener(const QHostAddress &address) int QFtpDTP::setupListener(const QHostAddress &address)
{ {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket //copy network session down to the socket
listener.setProperty("_q_networksession", property("_q_networksession")); listener.setProperty("_q_networksession", property("_q_networksession"));
#endif #endif
@ -817,7 +817,7 @@ QFtpPI::QFtpPI(QObject *parent) :
void QFtpPI::connectToHost(const QString &host, quint16 port) void QFtpPI::connectToHost(const QString &host, quint16 port)
{ {
emit connectState(QFtp::HostLookup); emit connectState(QFtp::HostLookup);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket & DTP //copy network session down to the socket & DTP
commandSocket.setProperty("_q_networksession", property("_q_networksession")); commandSocket.setProperty("_q_networksession", property("_q_networksession"));
dtp.setProperty("_q_networksession", property("_q_networksession")); dtp.setProperty("_q_networksession", property("_q_networksession"));
@ -2287,7 +2287,7 @@ void QFtpPrivate::_q_startNextCommand()
c->rawCmds.clear(); c->rawCmds.clear();
_q_piFinished(QLatin1String("Proxy set to ") + proxyHost + QLatin1Char(':') + QString::number(proxyPort)); _q_piFinished(QLatin1String("Proxy set to ") + proxyHost + QLatin1Char(':') + QString::number(proxyPort));
} else if (c->command == QFtp::ConnectToHost) { } else if (c->command == QFtp::ConnectToHost) {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the PI //copy network session down to the PI
pi.setProperty("_q_networksession", q->property("_q_networksession")); pi.setProperty("_q_networksession", q->property("_q_networksession"));
#endif #endif

View File

@ -135,7 +135,7 @@ void QHttpNetworkConnectionPrivate::init()
for (int i = 0; i < channelCount; i++) { for (int i = 0; i < channelCount; i++) {
channels[i].setConnection(this->q_func()); channels[i].setConnection(this->q_func());
channels[i].ssl = encrypt; channels[i].ssl = encrypt;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//push session down to channels //push session down to channels
channels[i].networkSession = networkSession; channels[i].networkSession = networkSession;
#endif #endif
@ -1272,7 +1272,7 @@ void QHttpNetworkConnectionPrivate::startNetworkLayerStateLookup()
channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol; channels[1].networkLayerPreference = QAbstractSocket::IPv6Protocol;
int timeout = 300; int timeout = 300;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (networkSession) { if (networkSession) {
const QNetworkConfiguration::BearerType bearerType = networkSession->configuration().bearerType(); const QNetworkConfiguration::BearerType bearerType = networkSession->configuration().bearerType();
if (bearerType == QNetworkConfiguration::Bearer2G) if (bearerType == QNetworkConfiguration::Bearer2G)
@ -1314,7 +1314,7 @@ void QHttpNetworkConnectionPrivate::_q_connectDelayedChannel()
channels[1].ensureConnection(); channels[1].ensureConnection();
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt, QHttpNetworkConnection::QHttpNetworkConnection(const QString &hostName, quint16 port, bool encrypt,
QHttpNetworkConnection::ConnectionType connectionType, QHttpNetworkConnection::ConnectionType connectionType,
QObject *parent, QSharedPointer<QNetworkSession> networkSession) QObject *parent, QSharedPointer<QNetworkSession> networkSession)

View File

@ -101,7 +101,7 @@ public:
ConnectionTypeHTTP2Direct ConnectionTypeHTTP2Direct
}; };
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false, explicit QHttpNetworkConnection(const QString &hostName, quint16 port = 80, bool encrypt = false,
ConnectionType connectionType = ConnectionTypeHTTP, ConnectionType connectionType = ConnectionTypeHTTP,
QObject *parent = nullptr, QSharedPointer<QNetworkSession> networkSession QObject *parent = nullptr, QSharedPointer<QNetworkSession> networkSession
@ -292,7 +292,7 @@ public:
QSharedPointer<QSslContext> sslContext; QSharedPointer<QSslContext> sslContext;
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession; QSharedPointer<QNetworkSession> networkSession;
#endif #endif

View File

@ -57,7 +57,7 @@
# include <QtNetwork/qsslcipher.h> # include <QtNetwork/qsslcipher.h>
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
#include "private/qnetworksession_p.h" #include "private/qnetworksession_p.h"
#endif #endif
@ -124,7 +124,7 @@ void QHttpNetworkConnectionChannel::init()
#else #else
socket = new QTcpSocket; socket = new QTcpSocket;
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//push session down to socket //push session down to socket
if (networkSession) if (networkSession)
socket->setProperty("_q_networksession", QVariant::fromValue(networkSession)); socket->setProperty("_q_networksession", QVariant::fromValue(networkSession));

View File

@ -139,7 +139,7 @@ public:
#endif #endif
// to emit the signal for all in-flight replies: // to emit the signal for all in-flight replies:
void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message); void emitFinishedWithError(QNetworkReply::NetworkError error, const char *message);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession; QSharedPointer<QNetworkSession> networkSession;
#endif #endif

View File

@ -185,7 +185,7 @@ public:
QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt,
QHttpNetworkConnection::ConnectionType connectionType) QHttpNetworkConnection::ConnectionType connectionType)
: QHttpNetworkConnection(hostName, port, encrypt, connectionType) : QHttpNetworkConnection(hostName, port, encrypt, connectionType)
#else #else // ### Qt6: Remove section
QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt, QNetworkAccessCachedHttpConnection(const QString &hostName, quint16 port, bool encrypt,
QHttpNetworkConnection::ConnectionType connectionType, QHttpNetworkConnection::ConnectionType connectionType,
QSharedPointer<QNetworkSession> networkSession) QSharedPointer<QNetworkSession> networkSession)
@ -348,7 +348,7 @@ void QHttpThreadDelegate::startRequest()
#ifdef QT_NO_BEARERMANAGEMENT #ifdef QT_NO_BEARERMANAGEMENT
httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl,
connectionType); connectionType);
#else #else // ### Qt6: Remove section
httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl,
connectionType, connectionType,
networkSession); networkSession);

View File

@ -118,7 +118,7 @@ public:
QNetworkReply::NetworkError incomingErrorCode; QNetworkReply::NetworkError incomingErrorCode;
QString incomingErrorDetail; QString incomingErrorDetail;
QHttp2Configuration http2Parameters; QHttp2Configuration http2Parameters;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession; QSharedPointer<QNetworkSession> networkSession;
#endif #endif

View File

@ -371,7 +371,7 @@ void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors)
*/ */
bool QNetworkAccessBackend::start() bool QNetworkAccessBackend::start()
{ {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// For bearer, check if session start is required // For bearer, check if session start is required
QSharedPointer<QNetworkSession> networkSession(manager->getNetworkSession()); QSharedPointer<QNetworkSession> networkSession(manager->getNetworkSession());
if (networkSession) { if (networkSession) {

View File

@ -161,7 +161,7 @@ void QNetworkAccessFtpBackend::open()
if (!objectCache->requestEntry(cacheKey, this, if (!objectCache->requestEntry(cacheKey, this,
SLOT(ftpConnectionReady(QNetworkAccessCache::CacheableObject*)))) { SLOT(ftpConnectionReady(QNetworkAccessCache::CacheableObject*)))) {
ftp = new QNetworkAccessCachedFtpConnection; ftp = new QNetworkAccessCachedFtpConnection;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the QFtp //copy network session down to the QFtp
ftp->setProperty("_q_networksession", property("_q_networksession")); ftp->setProperty("_q_networksession", property("_q_networksession"));
#endif #endif

View File

@ -311,6 +311,7 @@ static void ensureInitialized()
/*! /*!
\fn void QNetworkAccessManager::networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible) \fn void QNetworkAccessManager::networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible)
\obsolete
This signal is emitted when the value of the \l networkAccessible property changes. This signal is emitted when the value of the \l networkAccessible property changes.
\a accessible is the new network accessibility. \a accessible is the new network accessibility.
@ -320,6 +321,7 @@ static void ensureInitialized()
\fn void QNetworkAccessManager::networkSessionConnected() \fn void QNetworkAccessManager::networkSessionConnected()
\since 4.7 \since 4.7
\obsolete
\internal \internal
@ -1008,10 +1010,11 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ
return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request)); return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
/*! /*!
\since 4.7 \since 4.7
\obsolete
Sets the network configuration that will be used when creating the Sets the network configuration that will be used when creating the
\l {QNetworkSession}{network session} to \a config. \l {QNetworkSession}{network session} to \a config.
@ -1049,6 +1052,7 @@ void QNetworkAccessManager::setConfiguration(const QNetworkConfiguration &config
/*! /*!
\since 4.7 \since 4.7
\obsolete
Returns the network configuration that will be used to create the Returns the network configuration that will be used to create the
\l {QNetworkSession}{network session} which will be used when processing network requests. \l {QNetworkSession}{network session} which will be used when processing network requests.
@ -1069,6 +1073,7 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const
/*! /*!
\since 4.7 \since 4.7
\obsolete
Returns the current active network configuration. Returns the current active network configuration.
@ -1097,6 +1102,7 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const
/*! /*!
\since 4.7 \since 4.7
\obsolete
Overrides the reported network accessibility. If \a accessible is NotAccessible the reported Overrides the reported network accessibility. If \a accessible is NotAccessible the reported
network accessiblity will always be NotAccessible. Otherwise the reported network network accessiblity will always be NotAccessible. Otherwise the reported network
@ -1109,16 +1115,20 @@ void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkA
d->defaultAccessControl = accessible == NotAccessible ? false : true; d->defaultAccessControl = accessible == NotAccessible ? false : true;
if (d->networkAccessible != accessible) { if (d->networkAccessible != accessible) {
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
NetworkAccessibility previous = networkAccessible(); NetworkAccessibility previous = networkAccessible();
d->networkAccessible = accessible; d->networkAccessible = accessible;
NetworkAccessibility current = networkAccessible(); NetworkAccessibility current = networkAccessible();
if (previous != current) if (previous != current)
emit networkAccessibleChanged(current); emit networkAccessibleChanged(current);
QT_WARNING_POP
} }
} }
/*! /*!
\since 4.7 \since 4.7
\obsolete
Returns the current network accessibility. Returns the current network accessibility.
*/ */
@ -1484,7 +1494,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
if (!d->statusMonitor.isMonitoring() && !d->statusMonitor.start()) if (!d->statusMonitor.isMonitoring() && !d->statusMonitor.start())
qWarning(lcNetMon, "failed to start network status monitoring"); qWarning(lcNetMon, "failed to start network status monitoring");
} else { } else {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// Return a disabled network reply if network access is disabled. // Return a disabled network reply if network access is disabled.
// Except if the scheme is empty or file:// or if the host resolves to a loopback address. // Except if the scheme is empty or file:// or if the host resolves to a loopback address.
if (d->networkAccessible == NotAccessible && !isLocalFile) { if (d->networkAccessible == NotAccessible && !isLocalFile) {
@ -1558,7 +1568,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
} }
#endif #endif
QNetworkReplyHttpImpl *reply = new QNetworkReplyHttpImpl(this, request, op, outgoingData); QNetworkReplyHttpImpl *reply = new QNetworkReplyHttpImpl(this, request, op, outgoingData);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (!d->statusMonitor.isEnabled()) { if (!d->statusMonitor.isEnabled()) {
connect(this, SIGNAL(networkSessionConnected()), connect(this, SIGNAL(networkSessionConnected()),
reply, SLOT(_q_networkSessionConnected())); reply, SLOT(_q_networkSessionConnected()));
@ -1570,7 +1580,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
// first step: create the reply // first step: create the reply
QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// NETMONTODO: network reply impl must be augmented to use the same monitoring // NETMONTODO: network reply impl must be augmented to use the same monitoring
// capabilities as http network reply impl does. Once it does: uncomment the condition below // capabilities as http network reply impl does. Once it does: uncomment the condition below
if (!isLocalFile /*&& !d->statusMonitor.isEnabled()*/) { if (!isLocalFile /*&& !d->statusMonitor.isEnabled()*/) {
@ -1761,7 +1771,7 @@ void QNetworkAccessManagerPrivate::_q_replyFinished(QNetworkReply *reply)
if (reply->request().attribute(QNetworkRequest::AutoDeleteReplyOnFinishAttribute, false).toBool()) if (reply->request().attribute(QNetworkRequest::AutoDeleteReplyOnFinishAttribute, false).toBool())
QMetaObject::invokeMethod(reply, [reply] { reply->deleteLater(); }, Qt::QueuedConnection); QMetaObject::invokeMethod(reply, [reply] { reply->deleteLater(); }, Qt::QueuedConnection);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// If there are no active requests, release our reference to the network session. // If there are no active requests, release our reference to the network session.
// It will not be destroyed immediately, but rather when the connection cache is flushed // It will not be destroyed immediately, but rather when the connection cache is flushed
// after 2 minutes. // after 2 minutes.
@ -1819,7 +1829,7 @@ QNetworkReply *QNetworkAccessManagerPrivate::postProcess(QNetworkReply *reply)
q->connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(_q_replySslErrors(QList<QSslError>))); q->connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(_q_replySslErrors(QList<QSslError>)));
q->connect(reply, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), SLOT(_q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*))); q->connect(reply, SIGNAL(preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)), SLOT(_q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)));
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
activeReplyCount++; activeReplyCount++;
#endif #endif
@ -1989,7 +1999,7 @@ void QNetworkAccessManagerPrivate::destroyThread()
} }
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config)
{ {
Q_Q(QNetworkAccessManager); Q_Q(QNetworkAccessManager);
@ -2024,10 +2034,13 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co
if (!networkSessionStrongRef) { if (!networkSessionStrongRef) {
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
if (networkAccessible == QNetworkAccessManager::NotAccessible || !online) if (networkAccessible == QNetworkAccessManager::NotAccessible || !online)
emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible);
else else
emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility);
QT_WARNING_POP
return; return;
} }
@ -2074,6 +2087,8 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
bool reallyOnline = false; bool reallyOnline = false;
//Do not emit the networkSessionConnected signal here, except for roaming -> connected //Do not emit the networkSessionConnected signal here, except for roaming -> connected
//transition, otherwise it is emitted twice in a row when opening a connection. //transition, otherwise it is emitted twice in a row when opening a connection.
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
if (state == QNetworkSession::Connected && lastSessionState != QNetworkSession::Roaming) if (state == QNetworkSession::Connected && lastSessionState != QNetworkSession::Roaming)
emit q->networkSessionConnected(); emit q->networkSessionConnected();
lastSessionState = state; lastSessionState = state;
@ -2109,6 +2124,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession
_q_networkSessionClosed(); _q_networkSessionClosed();
createSession(q->configuration()); createSession(q->configuration());
} }
QT_WARNING_POP
} }
void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline) void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
@ -2120,6 +2136,8 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
return; return;
} }
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
// if the user set a config, we only care whether this one is active. // if the user set a config, we only care whether this one is active.
// Otherwise, this QNAM is online if there is an online config. // Otherwise, this QNAM is online if there is an online config.
@ -2145,6 +2163,7 @@ void QNetworkAccessManagerPrivate::_q_onlineStateChanged(bool isOnline)
emit q->networkAccessibleChanged(networkAccessible); emit q->networkAccessibleChanged(networkAccessible);
} }
} }
QT_WARNING_POP
} }
void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfiguration &configuration) void QNetworkAccessManagerPrivate::_q_configurationChanged(const QNetworkConfiguration &configuration)

View File

@ -64,7 +64,7 @@ class QNetworkProxy;
class QNetworkProxyFactory; class QNetworkProxyFactory;
class QSslError; class QSslError;
class QHstsPolicy; class QHstsPolicy;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
class QNetworkConfiguration; class QNetworkConfiguration;
#endif #endif
class QHttpMultiPart; class QHttpMultiPart;
@ -75,7 +75,7 @@ class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject
{ {
Q_OBJECT Q_OBJECT
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_PROPERTY(NetworkAccessibility networkAccessible READ networkAccessible WRITE setNetworkAccessible NOTIFY networkAccessibleChanged) Q_PROPERTY(NetworkAccessibility networkAccessible READ networkAccessible WRITE setNetworkAccessible NOTIFY networkAccessibleChanged)
#endif #endif
@ -91,7 +91,7 @@ public:
UnknownOperation = 0 UnknownOperation = 0
}; };
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
enum NetworkAccessibility { enum NetworkAccessibility {
UnknownAccessibility = -1, UnknownAccessibility = -1,
NotAccessible = 0, NotAccessible = 0,
@ -146,13 +146,13 @@ public:
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart);
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #if !defined(QT_NO_BEARERMANAGEMENT) // ### Qt6: Remove section
void setConfiguration(const QNetworkConfiguration &config); QT_DEPRECATED_VERSION_5_15 void setConfiguration(const QNetworkConfiguration &config);
QNetworkConfiguration configuration() const; QT_DEPRECATED_VERSION_5_15 QNetworkConfiguration configuration() const;
QNetworkConfiguration activeConfiguration() const; QT_DEPRECATED_VERSION_5_15 QNetworkConfiguration activeConfiguration() const;
void setNetworkAccessible(NetworkAccessibility accessible); QT_DEPRECATED_VERSION_5_15 void setNetworkAccessible(NetworkAccessibility accessible);
NetworkAccessibility networkAccessible() const; QT_DEPRECATED_VERSION_5_15 NetworkAccessibility networkAccessible() const;
#endif #endif
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
@ -185,10 +185,10 @@ Q_SIGNALS:
void preSharedKeyAuthenticationRequired(QNetworkReply *reply, QSslPreSharedKeyAuthenticator *authenticator); void preSharedKeyAuthenticationRequired(QNetworkReply *reply, QSslPreSharedKeyAuthenticator *authenticator);
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void networkSessionConnected(); QT_DEPRECATED_VERSION_5_15 void networkSessionConnected();
void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible); QT_DEPRECATED_VERSION_5_15 void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible);
#endif #endif
protected: protected:
@ -210,7 +210,7 @@ private:
Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_DECLARE_PRIVATE(QNetworkAccessManager)
Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>))
Q_PRIVATE_SLOT(d_func(), void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*)) Q_PRIVATE_SLOT(d_func(), void _q_replyPreSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator*))
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
Q_PRIVATE_SLOT(d_func(), void _q_configurationChanged(const QNetworkConfiguration &)) Q_PRIVATE_SLOT(d_func(), void _q_configurationChanged(const QNetworkConfiguration &))

View File

@ -62,7 +62,7 @@
#include "QtNetwork/qnetworkproxy.h" #include "QtNetwork/qnetworkproxy.h"
#include "QtNetwork/qnetworksession.h" #include "QtNetwork/qnetworksession.h"
#include "qnetworkaccessauthenticationmanager_p.h" #include "qnetworkaccessauthenticationmanager_p.h"
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
#include "QtNetwork/qnetworkconfigmanager.h" #include "QtNetwork/qnetworkconfigmanager.h"
#endif #endif
@ -87,7 +87,7 @@ public:
#ifndef QT_NO_NETWORKPROXY #ifndef QT_NO_NETWORKPROXY
proxyFactory(nullptr), proxyFactory(nullptr),
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
lastSessionState(QNetworkSession::Invalid), lastSessionState(QNetworkSession::Invalid),
networkConfiguration(networkConfigurationManager.defaultConfiguration()), networkConfiguration(networkConfigurationManager.defaultConfiguration()),
customNetworkConfiguration(false), customNetworkConfiguration(false),
@ -102,7 +102,7 @@ public:
redirectPolicy(QNetworkRequest::ManualRedirectPolicy), redirectPolicy(QNetworkRequest::ManualRedirectPolicy),
authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create()) authenticationManager(QSharedPointer<QNetworkAccessAuthenticationManager>::create())
{ {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// we would need all active configurations to check for // we would need all active configurations to check for
// d->networkConfigurationManager.isOnline(), which is asynchronous // d->networkConfigurationManager.isOnline(), which is asynchronous
// and potentially expensive. We can just check the configuration here // and potentially expensive. We can just check the configuration here
@ -153,7 +153,7 @@ public:
QStringList backendSupportedSchemes() const; QStringList backendSupportedSchemes() const;
void _q_onlineStateChanged(bool isOnline); void _q_onlineStateChanged(bool isOnline);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void createSession(const QNetworkConfiguration &config); void createSession(const QNetworkConfiguration &config);
QSharedPointer<QNetworkSession> getNetworkSession() const; QSharedPointer<QNetworkSession> getNetworkSession() const;
@ -186,7 +186,7 @@ public:
QNetworkProxyFactory *proxyFactory; QNetworkProxyFactory *proxyFactory;
#endif #endif
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSessionStrongRef; QSharedPointer<QNetworkSession> networkSessionStrongRef;
QWeakPointer<QNetworkSession> networkSessionWeakRef; QWeakPointer<QNetworkSession> networkSessionWeakRef;
QNetworkSession::State lastSessionState; QNetworkSession::State lastSessionState;
@ -231,7 +231,7 @@ public:
int transferTimeout = 0; int transferTimeout = 0;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_AUTOTEST_EXPORT static const QWeakPointer<const QNetworkSession> getNetworkSession(const QNetworkAccessManager *manager); Q_AUTOTEST_EXPORT static const QWeakPointer<const QNetworkSession> getNetworkSession(const QNetworkAccessManager *manager);
#endif #endif
Q_DECLARE_PUBLIC(QNetworkAccessManager) Q_DECLARE_PUBLIC(QNetworkAccessManager)

View File

@ -164,7 +164,7 @@ static QHash<QByteArray, QByteArray> parseHttpOptionHeader(const QByteArray &hea
} }
} }
#if QT_CONFIG(bearermanagement) #if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
static bool isSessionNeeded(const QUrl &url) static bool isSessionNeeded(const QUrl &url)
{ {
if (QNetworkStatusMonitor::isEnabled()) { if (QNetworkStatusMonitor::isEnabled()) {
@ -801,7 +801,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
QHttpThreadDelegate *delegate = new QHttpThreadDelegate; QHttpThreadDelegate *delegate = new QHttpThreadDelegate;
// Propagate Http/2 settings: // Propagate Http/2 settings:
delegate->http2Parameters = request.http2Configuration(); delegate->http2Parameters = request.http2Configuration();
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (!QNetworkStatusMonitor::isEnabled()) if (!QNetworkStatusMonitor::isEnabled())
delegate->networkSession = managerPrivate->getNetworkSession(); delegate->networkSession = managerPrivate->getNetworkSession();
#endif #endif
@ -1209,7 +1209,7 @@ void QNetworkReplyHttpImplPrivate::followRedirect()
if (managerPrivate->thread) if (managerPrivate->thread)
managerPrivate->thread->disconnect(); managerPrivate->thread->disconnect();
#if QT_CONFIG(bearermanagement) #if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
// If the original request didn't need a session (i.e. it was to localhost) // If the original request didn't need a session (i.e. it was to localhost)
// then we might not have a session open, to which to redirect, if the // then we might not have a session open, to which to redirect, if the
// new URL is remote. When this happens, we need to open the session now: // new URL is remote. When this happens, we need to open the session now:
@ -1794,13 +1794,13 @@ void QNetworkReplyHttpImplPrivate::setResumeOffset(quint64 offset)
*/ */
bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest)
{ {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession()); QSharedPointer<QNetworkSession> networkSession(managerPrivate->getNetworkSession());
if (!networkSession || QNetworkStatusMonitor::isEnabled()) { if (!networkSession || QNetworkStatusMonitor::isEnabled()) {
#endif #endif
postRequest(newHttpRequest); postRequest(newHttpRequest);
return true; return true;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
} }
// This is not ideal. // This is not ideal.
@ -1829,7 +1829,7 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest)
#endif #endif
} }
#if QT_CONFIG(bearermanagement) #if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer<QNetworkSession> &session) bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer<QNetworkSession> &session)
{ {
Q_Q(QNetworkReplyHttpImpl); Q_Q(QNetworkReplyHttpImpl);
@ -1865,7 +1865,7 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation()
state = Working; state = Working;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// Do not start background requests if they are not allowed by session policy // Do not start background requests if they are not allowed by session policy
QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());
QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false)); QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false));
@ -2061,7 +2061,7 @@ void QNetworkReplyHttpImplPrivate::setupTransferTimeout()
} }
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected() void QNetworkReplyHttpImplPrivate::_q_networkSessionConnected()
{ {
Q_Q(QNetworkReplyHttpImpl); Q_Q(QNetworkReplyHttpImpl);
@ -2197,7 +2197,7 @@ void QNetworkReplyHttpImplPrivate::finished()
if (preMigrationDownloaded != Q_INT64_C(-1)) if (preMigrationDownloaded != Q_INT64_C(-1))
totalSize = totalSize.toLongLong() + preMigrationDownloaded; totalSize = totalSize.toLongLong() + preMigrationDownloaded;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_ASSERT(managerPrivate); Q_ASSERT(managerPrivate);
QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession(); QSharedPointer<QNetworkSession> session = managerPrivate->getNetworkSession();
if (!QNetworkStatusMonitor::isEnabled() && session && session->state() == QNetworkSession::Roaming && if (!QNetworkStatusMonitor::isEnabled() && session && session->state() == QNetworkSession::Roaming &&

View File

@ -66,7 +66,7 @@
#include <private/qhttpnetworkrequest_p.h> #include <private/qhttpnetworkrequest_p.h>
#include <private/qnetworkreply_p.h> #include <private/qnetworkreply_p.h>
#include <QtNetwork/QNetworkProxy> #include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkSession> #include <QtNetwork/QNetworkSession> // ### Qt6: Remove include
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
#include <QtNetwork/QSslConfiguration> #include <QtNetwork/QSslConfiguration>
@ -102,7 +102,7 @@ public:
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
Q_PRIVATE_SLOT(d_func(), void _q_transferTimedOut()) Q_PRIVATE_SLOT(d_func(), void _q_transferTimedOut())
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
@ -162,7 +162,7 @@ signals:
class QNetworkReplyHttpImplPrivate: public QNetworkReplyPrivate class QNetworkReplyHttpImplPrivate: public QNetworkReplyPrivate
{ {
#if QT_CONFIG(bearermanagement) #if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
bool startWaitForSession(QSharedPointer<QNetworkSession> &session); bool startWaitForSession(QSharedPointer<QNetworkSession> &session);
#endif #endif
@ -186,7 +186,7 @@ public:
void _q_transferTimedOut(); void _q_transferTimedOut();
void setupTransferTimeout(); void setupTransferTimeout();
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void _q_networkSessionConnected(); void _q_networkSessionConnected();
void _q_networkSessionFailed(); void _q_networkSessionFailed();
void _q_networkSessionStateChanged(QNetworkSession::State); void _q_networkSessionStateChanged(QNetworkSession::State);

View File

@ -45,7 +45,7 @@
#include "QtCore/qcoreapplication.h" #include "QtCore/qcoreapplication.h"
#include "QtCore/qdatetime.h" #include "QtCore/qdatetime.h"
#include "QtNetwork/qsslconfiguration.h" #include "QtNetwork/qsslconfiguration.h"
#include "QtNetwork/qnetworksession.h" #include "QtNetwork/qnetworksession.h" // ### Qt6: Remove include
#include "qnetworkaccessmanager_p.h" #include "qnetworkaccessmanager_p.h"
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
@ -88,7 +88,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
return; return;
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_Q(QNetworkReplyImpl); Q_Q(QNetworkReplyImpl);
// Do not start background requests if they are not allowed by session policy // Do not start background requests if they are not allowed by session policy
QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession()); QSharedPointer<QNetworkSession> session(manager->d_func()->getNetworkSession());
@ -102,7 +102,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
#endif #endif
if (!backend->start()) { if (!backend->start()) {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
// backend failed to start because the session state is not Connected. // backend failed to start because the session state is not Connected.
// QNetworkAccessManager will call _q_startOperation again for us when the session // QNetworkAccessManager will call _q_startOperation again for us when the session
// state changes. // state changes.
@ -132,7 +132,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
#endif #endif
return; return;
} else { } else {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (session) { if (session) {
QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)),
q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection);
@ -140,7 +140,7 @@ void QNetworkReplyImplPrivate::_q_startOperation()
#endif #endif
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (session) { if (session) {
//get notification of policy changes. //get notification of policy changes.
QObject::connect(session.data(), SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)), QObject::connect(session.data(), SIGNAL(usagePoliciesChanged(QNetworkSession::UsagePolicies)),
@ -287,7 +287,7 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData()
} }
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void QNetworkReplyImplPrivate::_q_networkSessionConnected() void QNetworkReplyImplPrivate::_q_networkSessionConnected()
{ {
Q_Q(QNetworkReplyImpl); Q_Q(QNetworkReplyImpl);
@ -787,7 +787,7 @@ void QNetworkReplyImplPrivate::finished()
totalSize = totalSize.toLongLong() + preMigrationDownloaded; totalSize = totalSize.toLongLong() + preMigrationDownloaded;
if (!manager.isNull()) { if (!manager.isNull()) {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> session (manager->d_func()->getNetworkSession()); QSharedPointer<QNetworkSession> session (manager->d_func()->getNetworkSession());
if (session && session->state() == QNetworkSession::Roaming && if (session && session->state() == QNetworkSession::Roaming &&
state == Working && errorCode != QNetworkReply::OperationCanceledError) { state == Working && errorCode != QNetworkReply::OperationCanceledError) {

View File

@ -62,7 +62,7 @@
#include "private/qringbuffer_p.h" #include "private/qringbuffer_p.h"
#include "private/qbytedata_p.h" #include "private/qbytedata_p.h"
#include <QSharedPointer> #include <QSharedPointer>
#include <QtNetwork/QNetworkSession> #include <QtNetwork/QNetworkSession> // ### Qt6: Remove include
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -92,7 +92,7 @@ public:
Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished())
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData())
Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished())
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State))
@ -124,7 +124,7 @@ public:
void _q_copyReadChannelFinished(); void _q_copyReadChannelFinished();
void _q_bufferOutgoingData(); void _q_bufferOutgoingData();
void _q_bufferOutgoingDataFinished(); void _q_bufferOutgoingDataFinished();
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
void _q_networkSessionConnected(); void _q_networkSessionConnected();
void _q_networkSessionFailed(); void _q_networkSessionFailed();
void _q_networkSessionStateChanged(QNetworkSession::State); void _q_networkSessionStateChanged(QNetworkSession::State);

View File

@ -464,7 +464,10 @@
#include "qabstractsocket_p.h" #include "qabstractsocket_p.h"
#include "private/qhostinfo_p.h" #include "private/qhostinfo_p.h"
#if QT_CONFIG(bearermanagement) // ### Qt6: Remove section
#include "private/qnetworksession_p.h" #include "private/qnetworksession_p.h"
#endif
#include "private/qnetworkconfiguration_p.h" // ### Qt6: Remove include
#include <qabstracteventdispatcher.h> #include <qabstracteventdispatcher.h>
#include <qhostaddress.h> #include <qhostaddress.h>
@ -643,7 +646,7 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
QAbstractSocket::tr("Operation on socket is not supported")); QAbstractSocket::tr("Operation on socket is not supported"));
return false; return false;
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set) //copy network session down to the socket engine (if it has been set)
socketEngine->setProperty("_q_networksession", q->property("_q_networksession")); socketEngine->setProperty("_q_networksession", q->property("_q_networksession"));
#endif #endif
@ -1146,7 +1149,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
Qt::DirectConnection); Qt::DirectConnection);
} }
int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout; int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(q->property("_q_networksession")); QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(q->property("_q_networksession"));
if (networkSession) { if (networkSession) {
QNetworkConfiguration networkConfiguration = networkSession->configuration(); QNetworkConfiguration networkConfiguration = networkSession->configuration();
@ -1941,7 +1944,7 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
d->setError(UnsupportedSocketOperationError, tr("Operation on socket is not supported")); d->setError(UnsupportedSocketOperationError, tr("Operation on socket is not supported"));
return false; return false;
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set) //copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession")); d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif #endif
@ -2134,7 +2137,7 @@ bool QAbstractSocket::waitForConnected(int msecs)
QElapsedTimer stopWatch; QElapsedTimer stopWatch;
stopWatch.start(); stopWatch.start();
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(property("_q_networksession")); QSharedPointer<QNetworkSession> networkSession = qvariant_cast< QSharedPointer<QNetworkSession> >(property("_q_networksession"));
#endif #endif
@ -2157,7 +2160,7 @@ bool QAbstractSocket::waitForConnected(int msecs)
return false; // connect not im progress anymore! return false; // connect not im progress anymore!
int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout; int connectTimeout = QNetworkConfigurationPrivate::DefaultTimeout;
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
if (networkSession) { if (networkSession) {
QNetworkConfiguration networkConfiguration = networkSession->configuration(); QNetworkConfiguration networkConfiguration = networkSession->configuration();
connectTimeout = networkConfiguration.connectTimeout(); connectTimeout = networkConfiguration.connectTimeout();

View File

@ -72,7 +72,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
setSocketType(type); setSocketType(type);
d->socket = new QTcpSocket(this); d->socket = new QTcpSocket(this);
d->reply = new QHttpNetworkReply(QUrl(), this); d->reply = new QHttpNetworkReply(QUrl(), this);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
d->socket->setProperty("_q_networkSession", property("_q_networkSession")); d->socket->setProperty("_q_networkSession", property("_q_networkSession"));
#endif #endif

View File

@ -535,7 +535,7 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
udpData = new QSocks5UdpAssociateData; udpData = new QSocks5UdpAssociateData;
data = udpData; data = udpData;
udpData->udpSocket = new QUdpSocket(q); udpData->udpSocket = new QUdpSocket(q);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
udpData->udpSocket->setProperty("_q_networksession", q->property("_q_networksession")); udpData->udpSocket->setProperty("_q_networksession", q->property("_q_networksession"));
#endif #endif
udpData->udpSocket->setProxy(QNetworkProxy::NoProxy); udpData->udpSocket->setProxy(QNetworkProxy::NoProxy);
@ -549,7 +549,7 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
} }
data->controlSocket = new QTcpSocket(q); data->controlSocket = new QTcpSocket(q);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
data->controlSocket->setProperty("_q_networksession", q->property("_q_networksession")); data->controlSocket->setProperty("_q_networksession", q->property("_q_networksession"));
#endif #endif
data->controlSocket->setProxy(QNetworkProxy::NoProxy); data->controlSocket->setProxy(QNetworkProxy::NoProxy);

View File

@ -314,7 +314,7 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port)
d->serverSocketErrorString = tr("Operation on socket is not supported"); d->serverSocketErrorString = tr("Operation on socket is not supported");
return false; return false;
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set) //copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession")); d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif #endif
@ -436,7 +436,7 @@ bool QTcpServer::setSocketDescriptor(qintptr socketDescriptor)
d->serverSocketErrorString = tr("Operation on socket is not supported"); d->serverSocketErrorString = tr("Operation on socket is not supported");
return false; return false;
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the socket engine (if it has been set) //copy network session down to the socket engine (if it has been set)
d->socketEngine->setProperty("_q_networksession", property("_q_networksession")); d->socketEngine->setProperty("_q_networksession", property("_q_networksession"));
#endif #endif

View File

@ -2519,7 +2519,7 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
q->setPeerName(QString()); q->setPeerName(QString());
plainSocket = new QTcpSocket(q); plainSocket = new QTcpSocket(q);
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
//copy network session down to the plain socket (if it has been set) //copy network session down to the plain socket (if it has been set)
plainSocket->setProperty("_q_networksession", q->property("_q_networksession")); plainSocket->setProperty("_q_networksession", q->property("_q_networksession"));
#endif #endif

View File

@ -58,7 +58,7 @@ tst_QNetworkAccessManager::tst_QNetworkAccessManager()
void tst_QNetworkAccessManager::networkAccessible() void tst_QNetworkAccessManager::networkAccessible()
{ {
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT // ### Qt6: Remove section
QNetworkAccessManager manager; QNetworkAccessManager manager;
qRegisterMetaType<QNetworkAccessManager::NetworkAccessibility>("QNetworkAccessManager::NetworkAccessibility"); qRegisterMetaType<QNetworkAccessManager::NetworkAccessibility>("QNetworkAccessManager::NetworkAccessibility");