diff --git a/README.md b/README.md index ba28c26..b9b8389 100644 --- a/README.md +++ b/README.md @@ -616,6 +616,8 @@ section. * Pausing/resuming folders and devices doesn't work when using scan-intervals with a lot of zeros because of Syncthing bug https://github.com/syncthing/syncthing/issues/4001. This has already been fixed on the Qt-side with https://codereview.qt-project.org/#/c/187069/. However, the fix is only available in Qt 5.9 and above. + * Redirections cannot be followed (e.g. from HTTP to HTTPS) because + `QNetworkRequest::RedirectPolicyAttribute` and `QNetworkRequest::NoLessSafeRedirectPolicy` are not available yet. * any Qt version: * The tray disconnects from the local instance when the network connection goes down. The network connection must be restored or the tray restarted to be able to connect to local Syncthing again. This is caused by Qt bug diff --git a/syncthingconnector/syncthingconnection_requests.cpp b/syncthingconnector/syncthingconnection_requests.cpp index ed4faa1..7019042 100644 --- a/syncthingconnector/syncthingconnection_requests.cpp +++ b/syncthingconnector/syncthingconnection_requests.cpp @@ -43,6 +43,11 @@ QNetworkRequest SyncthingConnection::prepareRequest(const QString &path, const Q QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded")); request.setRawHeader("X-API-Key", m_apiKey); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + // ensure redirects to HTTPS are enabled/allowed regardless of the Qt version + // note: This setting is only the default as of Qt 6 and only supported as of Qt 5.9. + request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); +#endif #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) request.setTransferTimeout(noTimeout ? 0 : m_requestTimeout); #endif