[Pkg-owncloud-commits] [owncloud-client] 18/103: Try scheme://host/owncloud if scheme://host/ did not work
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Apr 30 18:08:55 UTC 2014
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 dc043b5765e4360c3462dab5c356d7cc71325e1f
Author: Daniel Molkentin <danimo at owncloud.com>
Date: Mon Apr 14 15:10:08 2014 +0200
Try scheme://host/owncloud if scheme://host/ did not work
Fixes #1680
---
src/mirall/networkjobs.cpp | 19 ++++++++++++++++++-
src/mirall/owncloudsetupwizard.cpp | 2 +-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/mirall/networkjobs.cpp b/src/mirall/networkjobs.cpp
index 7a952fc..9f3b1c6 100644
--- a/src/mirall/networkjobs.cpp
+++ b/src/mirall/networkjobs.cpp
@@ -332,9 +332,15 @@ bool LsColJob::finished()
/*********************************************************************************************/
+namespace {
+const char statusphpC[] = "status.php";
+const char owncloudDirC[] = "owncloud/";
+}
+
CheckServerJob::CheckServerJob(Account *account, bool followRedirect, QObject *parent)
- : AbstractNetworkJob(account, QLatin1String("status.php") , parent)
+ : AbstractNetworkJob(account, QLatin1String(statusphpC) , parent)
, _followRedirects(followRedirect)
+ , _subdirFallback(false)
, _redirectCount(0)
{
setIgnoreCredentialFailure(true);
@@ -392,6 +398,16 @@ bool CheckServerJob::finished()
}
}
+ // The serverInstalls to /owncloud. Let's try that if the file wasn't found
+ // at the original location
+ if ((reply()->error() == QNetworkReply::ContentNotFoundError) && (!_subdirFallback)) {
+ _subdirFallback = true;
+ setPath(QLatin1String(owncloudDirC)+QLatin1String(statusphpC));
+ start();
+ qDebug() << "Retrying with" << reply()->url();
+ return false;
+ }
+
bool success = false;
QVariantMap status = QtJson::parse(QString::fromUtf8(reply()->readAll()), success).toMap();
// empty or invalid response
@@ -406,6 +422,7 @@ bool CheckServerJob::finished()
emit instanceFound(reply()->url(), status);
} else {
qDebug() << "No proper answer on " << requestedUrl;
+ emit instanceNotFound(reply());
}
return true;
}
diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp
index 548eafa..e6177ba 100644
--- a/src/mirall/owncloudsetupwizard.cpp
+++ b/src/mirall/owncloudsetupwizard.cpp
@@ -138,7 +138,7 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString)
CheckServerJob *job = new CheckServerJob(_ocWizard->account(), false, this);
job->setIgnoreCredentialFailure(true);
connect(job, SIGNAL(instanceFound(QUrl,QVariantMap)), SLOT(slotOwnCloudFoundAuth(QUrl,QVariantMap)));
- connect(job, SIGNAL(networkError(QNetworkReply*)), SLOT(slotNoOwnCloudFoundAuth(QNetworkReply*)));
+ connect(job, SIGNAL(instanceNotFound(QNetworkReply*)), SLOT(slotNoOwnCloudFoundAuth(QNetworkReply*)));
connect(job, SIGNAL(timeout(const QUrl&)), SLOT(slotNoOwnCloudFoundAuthTimeout(const QUrl&)));
job->setTimeout(10*1000);
job->start();
--
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