Follow redirects in subsonic

This commit is contained in:
Jonas Kvinge 2019-08-20 23:32:20 +02:00
parent 9c485c4d94
commit 4359f2a0ce
2 changed files with 15 additions and 3 deletions

View File

@ -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;

View File

@ -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() {