QNetworkAccessManager: return default configuration if without session

... instead of a zero configuration. That is documented already for
QNetworkAccessManager::setConfiguration().

Task-number: QTBUG-28973
Change-Id: Idba5be990745069667a50c85286cf530580d4efe
Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
This commit is contained in:
Peter Hartmann 2013-01-07 16:52:26 +01:00 committed by The Qt Project
parent 08bc730b41
commit 1df2b9ee23

View File

@ -834,10 +834,12 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const
Q_D(const QNetworkAccessManager); Q_D(const QNetworkAccessManager);
QSharedPointer<QNetworkSession> session(d->getNetworkSession()); QSharedPointer<QNetworkSession> session(d->getNetworkSession());
if (session) if (session) {
return session->configuration(); return session->configuration();
else } else {
return QNetworkConfiguration(); QNetworkConfigurationManager manager;
return manager.defaultConfiguration();
}
} }
/*! /*!
@ -860,13 +862,12 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const
Q_D(const QNetworkAccessManager); Q_D(const QNetworkAccessManager);
QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession()); QSharedPointer<QNetworkSession> networkSession(d->getNetworkSession());
QNetworkConfigurationManager manager;
if (networkSession) { if (networkSession) {
QNetworkConfigurationManager manager;
return manager.configurationFromIdentifier( return manager.configurationFromIdentifier(
networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); networkSession->sessionProperty(QLatin1String("ActiveConfiguration")).toString());
} else { } else {
return QNetworkConfiguration(); return manager.defaultConfiguration();
} }
} }