mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
dbhub: Also clear access cache when pushing a database as other user
This commit is contained in:
@@ -369,14 +369,8 @@ 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();
|
||||
}
|
||||
// Clear access cache if necessary
|
||||
clearAccessCache(clientCert);
|
||||
|
||||
// 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);
|
||||
@@ -427,6 +421,9 @@ void RemoteDatabase::push(const QString& filename, const QString& url, const QSt
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear access cache if necessary
|
||||
clearAccessCache(clientCert);
|
||||
|
||||
// Get file data
|
||||
// TODO: Don't read the entire file here but directly pass the file handle to the put() call below in order
|
||||
// to read larger files chunk by chunk.
|
||||
@@ -609,3 +606,15 @@ QString RemoteDatabase::localExists(const QUrl& url, QString identity)
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteDatabase::clearAccessCache(const QString& clientCert)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ private:
|
||||
void localAdd(QString filename, QString identity, const QUrl& url);
|
||||
QString localExists(const QUrl& url, QString identity);
|
||||
|
||||
// Before using a new client certificate we need to clear the access and authentication cache of the network manager
|
||||
// object. Otherwise Qt might reuse the old certificate if the requested URL has been used before.
|
||||
void clearAccessCache(const QString& clientCert);
|
||||
|
||||
QNetworkAccessManager* m_manager;
|
||||
QProgressDialog* m_progress;
|
||||
QNetworkReply* m_currentReply;
|
||||
|
||||
Reference in New Issue
Block a user