dbhub: Fix wrong certificate being used

When changing the client certificate we need to clear the authentication
and access cache of our Qt network access manager instance. If we don't
do so, Qt might decide to use the old certificate information which is
still in the cache for some recurring queries.
This commit is contained in:
Martin Kleusberg
2017-08-03 20:31:18 +02:00
parent e08ebffd63
commit f458ac37bf

View File

@@ -349,6 +349,15 @@ void RemoteDatabase::fetch(const QString& url, RequestType type, const QString&
return;
}
// When the client certificate is different from the one before, clear the access and authentication cache.
// Otherwise Qt might use the old certificate again.
static QString lastClientCert;
if(lastClientCert != clientCert)
{
lastClientCert = clientCert;
m_manager->clearAccessCache();
}
// Fetch database and save pending reply. Note that we're only supporting one active download here at the moment.
m_currentReply = m_manager->get(request);
m_currentReply->setProperty("type", type);