From 4359f2a0ce93a99eb3b98a4e7798b553f8807dc0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 20 Aug 2019 23:32:20 +0200 Subject: [PATCH] Follow redirects in subsonic --- src/subsonic/subsonicbaserequest.cpp | 10 ++++++++-- src/subsonic/subsonicrequest.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/subsonic/subsonicbaserequest.cpp b/src/subsonic/subsonicbaserequest.cpp index 2a0ffb552..6f8532730 100644 --- a/src/subsonic/subsonicbaserequest.cpp +++ b/src/subsonic/subsonicbaserequest.cpp @@ -46,8 +46,13 @@ SubsonicBaseRequest::SubsonicBaseRequest(SubsonicService *service, QObject *parent) : QObject(parent), service_(service), - network_(new QNetworkAccessManager) - {} + network_(new QNetworkAccessManager) { + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + network_->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); +#endif + +} SubsonicBaseRequest::~SubsonicBaseRequest() {} @@ -123,6 +128,7 @@ QByteArray SubsonicBaseRequest::GetReplyData(QNetworkReply *reply) { Error(QString("%1 (%2)").arg(reply->errorString()).arg(reply->error())); } else { + // See if there is Json data containing "error" - then use that instead. data = reply->readAll(); QString error; diff --git a/src/subsonic/subsonicrequest.cpp b/src/subsonic/subsonicrequest.cpp index a5b7b8c56..518178d53 100644 --- a/src/subsonic/subsonicrequest.cpp +++ b/src/subsonic/subsonicrequest.cpp @@ -65,7 +65,13 @@ SubsonicRequest::SubsonicRequest(SubsonicService *service, SubsonicUrlHandler *u album_covers_requested_(0), album_covers_received_(0), no_results_(false) - {} + { + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + network_->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy); +#endif + +} SubsonicRequest::~SubsonicRequest() {