Skip to content

Commit

Permalink
Always follow redirects in network jobs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Daniel Molkentin committed Aug 9, 2016
1 parent 73a6939 commit bad8d1b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion src/libsync/abstractnetworkjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/libsync/networkjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent)
: AbstractNetworkJob(account, QLatin1String(statusphpC) , parent)
, _subdirFallback(false)
{
_followRedirects = true;
setIgnoreCredentialFailure(true);
}

Expand Down
1 change: 0 additions & 1 deletion src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit bad8d1b

Please sign in to comment.