#include <QDir>
#include <QSslKey>
+#include <QUuid>
+
namespace OCC {
Q_LOGGING_CATEGORY(lcAccount, "sync.account", QtInfoMsg)
return _credentials.data();
}
+static QByteArray generateRequestId()
+{
+ // Use a UUID with the starting and ending curly brace removed.
+ auto uuid = QUuid::createUuid().toByteArray();
+ return uuid.mid(1, uuid.size() - 2);
+}
+
void Account::setCredentials(AbstractCredentials *cred)
{
// set active credential manager
SLOT(slotCredentialsFetched()));
connect(_credentials.data(), SIGNAL(asked()),
SLOT(slotCredentialsAsked()));
+
+ // Generate a new request id
+ _requestId = generateRequestId();
+ qCInfo(lcAccount) << "Account for" << url() << "has X-Request-ID" << _requestId;
}
QUrl Account::davUrl() const
{
req.setUrl(url);
req.setSslConfiguration(this->getOrCreateSslConfig());
+ req.setRawHeader("X-Request-ID", _requestId);
if (verb == "HEAD" && !data) {
return _am->head(req);
} else if (verb == "GET" && !data) {
/// Certificates that were explicitly rejected by the user
QList<QSslCertificate> _rejectedCertificates;
+ /// X-Request-ID to send in network requests
+ QByteArray _requestId;
+
static QString _configFileName;
QString _davPath; // defaults to value from theme, might be overwritten in brandings