From 34843cfe304e0a9bd14f8818058263f2617ce123 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Fri, 1 Sep 2023 11:56:47 +0200 Subject: [PATCH] Set redirect policy on all request --- src/libsync/abstractnetworkjob.cpp | 2 -- src/libsync/accessmanager.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp index bf12bcffed5..f62281c3442 100644 --- a/src/libsync/abstractnetworkjob.cpp +++ b/src/libsync/abstractnetworkjob.cpp @@ -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); diff --git a/src/libsync/accessmanager.cpp b/src/libsync/accessmanager.cpp index bf41921a6b3..35fe0659298 100644 --- a/src/libsync/accessmanager.cpp +++ b/src/libsync/accessmanager.cpp @@ -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