]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Always follow redirects in network jobs (#4905)
authorDaniel Molkentin <daniel@molkentin.de>
Tue, 9 Aug 2016 14:01:29 +0000 (16:01 +0200)
committerGitHub <noreply@github.com>
Tue, 9 Aug 2016 14:01:29 +0000 (16:01 +0200)
This is a move away from the original policy where jobs
would only follow redirects in special cases.

Two restrictions are in place:

1. We do not allow protocol downgrades (https -> http)
2. We stop redirects after we find them looping (e.g. old = new url, or
indirectly when looping 10 times).

This is closer to RFC conforming behavior, although currently
we will treat 301 replies like they were 302. This is for a separate
commit.

Error handling (and display) also needs improvement.

Addresses #2791

src/libsync/abstractnetworkjob.cpp
src/libsync/networkjobs.cpp
src/libsync/propagatedownload.cpp

index 4599ecaa2b6e0fcff35142b1b722e4c5e8a9b364..aa3b49fde1ba2383afef3834c74db9d0aed5f7fd 100644 (file)
@@ -43,7 +43,7 @@ namespace OCC {
 AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, QObject *parent)
     : QObject(parent)
     , _timedout(false)
-    , _followRedirects(false)
+    , _followRedirects(true)
     , _account(account)
     , _ignoreCredentialFailure(false)
     , _reply(0)
index 09472be8773aa79fe6ab4b6cb4306eec976a0247..ab5598468562779854d9c27de341b54213569c0d 100644 (file)
@@ -359,7 +359,6 @@ CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent)
     : AbstractNetworkJob(account, QLatin1String(statusphpC) , parent)
     , _subdirFallback(false)
 {
-       _followRedirects = true;
     setIgnoreCredentialFailure(true);
 }
 
index 2a126ee60779be9da62525d9504f70b52876c519..6473c40013753d45525f805ada36e292dcb27a39 100644 (file)
@@ -99,7 +99,6 @@ void GETFileJob::start() {
     } else {
         // Use direct URL
         setReply(davRequest("GET", _directDownloadUrl, req));
-        _followRedirects = true;  // (follow redirections for the direct download)
     }
     setupConnections(reply());