[Pkg-owncloud-commits] [owncloud-client] 89/164: setup wizard: use a PROPFIND instead of a GET on the webdav url

Sandro Knauß hefee-guest at moszumanska.debian.org
Sun Mar 22 11:56:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 4d85f1daecd8e562c5287761a3f9aeb56bc7e282
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Mar 3 16:01:41 2015 +0100

    setup wizard: use a PROPFIND instead of a GET on the webdav url
    
    In order to initiate the conneciton, we should not send a GET on the
    webdav URL because that is not a valid webdav command on a collection.
    
    Issue #2911
---
 src/gui/owncloudsetupwizard.cpp | 28 +++++-----------------------
 src/gui/owncloudsetupwizard.h   | 11 -----------
 src/gui/wizard/owncloudwizard.h |  2 +-
 3 files changed, 6 insertions(+), 35 deletions(-)

diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp
index f4709f3..13c3b55 100644
--- a/src/gui/owncloudsetupwizard.cpp
+++ b/src/gui/owncloudsetupwizard.cpp
@@ -211,9 +211,11 @@ void OwncloudSetupWizard::testOwnCloudConnect()
 {
     AccountPtr account = _ocWizard->account();
 
-    ValidateDavAuthJob *job = new ValidateDavAuthJob(account, this);
+    auto *job = new PropfindJob(account, "/", this);
     job->setIgnoreCredentialFailure(true);
-    connect(job, SIGNAL(authResult(QNetworkReply*)), SLOT(slotConnectionCheck(QNetworkReply*)));
+    job->setProperties(QList<QByteArray>() << "getlastmodified");
+    connect(job, SIGNAL(result(QVariantMap)),  _ocWizard, SLOT(successfulStep()));
+    connect(job, SIGNAL(networkError(QNetworkReply*)), this, SLOT(slotConnectionCheck(QNetworkReply*)));
     job->start();
 }
 
@@ -249,7 +251,7 @@ void OwncloudSetupWizard::slotConnectionCheck(QNetworkReply* reply)
         _ocWizard->successfulStep();
         break;
     default:
-        if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 403) {
+        if (!_ocWizard->account()->credentials()->stillValid(reply)) {
             msg = tr("Access forbidden by server. To verify that you have proper access, "
                      "<a href=\"%1\">click here</a> to access the service with your browser.")
                     .arg(_ocWizard->account()->url().toString());
@@ -534,24 +536,4 @@ bool DetermineAuthTypeJob::finished()
     return true;
 }
 
-ValidateDavAuthJob::ValidateDavAuthJob(AccountPtr account, QObject *parent)
-    : AbstractNetworkJob(account, QString(), parent)
-{
-}
-
-void ValidateDavAuthJob::start()
-{
-    QString p = account()->davPath();
-    QNetworkReply *reply = getRequest(p);
-    setReply(reply);
-    setupConnections(reply);
-    AbstractNetworkJob::start();
-}
-
-bool ValidateDavAuthJob::finished()
-{
-    emit authResult(reply());
-    return true;
-}
-
 } // namespace OCC
diff --git a/src/gui/owncloudsetupwizard.h b/src/gui/owncloudsetupwizard.h
index 60a683d..961d63f 100644
--- a/src/gui/owncloudsetupwizard.h
+++ b/src/gui/owncloudsetupwizard.h
@@ -31,17 +31,6 @@ namespace OCC {
 
 class OwncloudWizard;
 
-class ValidateDavAuthJob : public AbstractNetworkJob {
-    Q_OBJECT
-public:
-    ValidateDavAuthJob(AccountPtr account, QObject *parent = 0);
-    void start() Q_DECL_OVERRIDE;
-signals:
-    void authResult(QNetworkReply*);
-private slots:
-    bool finished() Q_DECL_OVERRIDE;
-};
-
 class DetermineAuthTypeJob : public AbstractNetworkJob {
     Q_OBJECT
 public:
diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h
index 06515a2..ebf42f9 100644
--- a/src/gui/wizard/owncloudwizard.h
+++ b/src/gui/wizard/owncloudwizard.h
@@ -58,7 +58,6 @@ public:
     void setMultipleFoldersExist( bool );
     void setConfigExists( bool );
     bool configExists();
-    void successfulStep();
     AbstractCredentials* getCredentials() const;
 
     void raiseCertificatePopup();
@@ -72,6 +71,7 @@ public slots:
     void setRemoteFolder( const QString& );
     void appendToConfigurationLog( const QString& msg, LogType type = LogParagraph );
     void slotCurrentPageChanged( int );
+    void successfulStep();
 
 signals:
     void clearPendingRequests();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list