Skip to content

Commit

Permalink
Set redirect policy on all request
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Sep 1, 2023
1 parent 1239b02 commit 34843cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/libsync/abstractnetworkjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ void AbstractNetworkJob::sendRequest(const QByteArray &verb,
_verb = verb;

_request = req;
// we don't follow redirects, if we receive one the ConnectionValidor is triggered
_request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);

// allow to transfer files with a big compression ratio
_request.setDecompressedSafetyCheckThreshold(-1);
Expand Down
6 changes: 6 additions & 0 deletions src/libsync/accessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ QNetworkReply *AccessManager::createRequest(QNetworkAccessManager::Operation op,
// Set the language, so messages from the server are localised correctly.
newRequest.setRawHeader("Accept-Language", QLocale().name().toUtf8());

// we don't follow redirects, if we receive one the ConnectionValidor is triggered
// -> default to manual redirection
if (newRequest.attribute(QNetworkRequest::RedirectPolicyAttribute).isNull()) {
newRequest.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
}

QByteArray verb = newRequest.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray();
// For PROPFIND (assumed to be a WebDAV op), set xml/utf8 as content type/encoding
// This needs extension
Expand Down

0 comments on commit 34843cf

Please sign in to comment.