TokenCredentials: Don't overwrite Cookie header

If the request already had a cookie header, there was a reason for it.
Don't blindly overwrite it.
This commit is contained in:
Markus Goetz 2014-08-11 15:40:12 +02:00
parent acd3df33b6
commit 8cd1d43798

View file

@ -88,7 +88,10 @@ protected:
QByteArray credHash = QByteArray(_cred->user().toUtf8()+":"+_cred->password().toUtf8()).toBase64();
req.setRawHeader(QByteArray("Authorization"), QByteArray("Basic ") + credHash);
req.setRawHeader("Cookie", _cred->_token.toUtf8()); // analogous to neon in syncContextPreStart
if (!req.hasRawHeader("Cookie")) {
// Only use our token if the request doesn't have a cookie already (e.g. because of direct download URL)
req.setRawHeader("Cookie", _cred->_token.toUtf8()); // analogous to neon in syncContextPreStart
}
return MirallAccessManager::createRequest(op, req, outgoingData);
}