mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 17:37:36 +03:00
Don't always send Auth headers
Use slotAuthentication again instead.
This commit is contained in:
parent
279a738aa6
commit
cfaaf4a2c4
2 changed files with 3 additions and 19 deletions
|
@ -64,6 +64,7 @@ ownCloudInfo* ownCloudInfo::instance()
|
|||
ownCloudInfo::ownCloudInfo() :
|
||||
QObject(0),
|
||||
_manager(0),
|
||||
_authAttempts(0),
|
||||
_lastQuotaTotalBytes(0),
|
||||
_lastQuotaUsedBytes(0)
|
||||
{
|
||||
|
@ -88,11 +89,8 @@ void ownCloudInfo::setNetworkAccessManager( QNetworkAccessManager* qnam )
|
|||
|
||||
// The authenticationRequired signal is not handled because the creds are set
|
||||
// in the request header.
|
||||
#if 0
|
||||
connect( _manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
|
||||
this, SLOT(slotAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||
#endif
|
||||
|
||||
// no cookie jar so far.
|
||||
_manager->setCookieJar(new oCCookieJar);
|
||||
|
||||
|
@ -346,7 +344,6 @@ void ownCloudInfo::slotGetQuotaFinished()
|
|||
#endif
|
||||
|
||||
// FIXME: remove this later, once the new connection dialog has settled.
|
||||
#if 0
|
||||
void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *auth )
|
||||
{
|
||||
if( !(auth && reply) ) return;
|
||||
|
@ -360,10 +357,8 @@ void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *aut
|
|||
|
||||
qDebug() << "Auth request to me and I am " << this;
|
||||
_authAttempts++;
|
||||
MirallConfigFile cfgFile( configHandle );
|
||||
qDebug() << "Authenticating request for " << reply->url();
|
||||
if( reply->url().toString().startsWith( cfgFile.ownCloudUrl( _connection, true )) ) {
|
||||
|
||||
if( reply->url().toString().startsWith( webdavUrl( _connection ) ) ) {
|
||||
QString con = configHandle;
|
||||
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
|
||||
if( _credentials.contains(con)) {
|
||||
|
@ -383,7 +378,6 @@ void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *aut
|
|||
reply->close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QString ownCloudInfo::configHandle(QNetworkReply *reply)
|
||||
{
|
||||
|
@ -616,16 +610,6 @@ void ownCloudInfo::setupHeaders( QNetworkRequest & req, quint64 size )
|
|||
qDebug() << "Setting up host header: " << url.host();
|
||||
req.setRawHeader( QByteArray("User-Agent"), Utility::userAgentString());
|
||||
|
||||
QString con = _configHandle;
|
||||
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
|
||||
if( _credentials.contains(con)) {
|
||||
oCICredentials creds = _credentials.value(con);
|
||||
QString concatenated = creds.user + QLatin1Char(':') + creds.passwd;
|
||||
const QString b(QLatin1String("Basic "));
|
||||
QByteArray data = b.toUtf8() + concatenated.toUtf8().toBase64();
|
||||
req.setRawHeader( QByteArray("Authorization"), data );
|
||||
}
|
||||
|
||||
if (size) {
|
||||
req.setHeader( QNetworkRequest::ContentLengthHeader, size);
|
||||
req.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String("text/xml; charset=utf-8"));
|
||||
|
|
|
@ -132,7 +132,7 @@ signals:
|
|||
protected slots:
|
||||
void slotReplyFinished( );
|
||||
void slotError( QNetworkReply::NetworkError );
|
||||
// void slotAuthentication( QNetworkReply*, QAuthenticator *);
|
||||
void slotAuthentication( QNetworkReply*, QAuthenticator *);
|
||||
|
||||
#if QT46_IMPL
|
||||
void qhttpRequestFinished(int id, bool success );
|
||||
|
|
Loading…
Reference in a new issue