From a85b3531c3fe6fe6fabd48946cbf33b2631fd4ea Mon Sep 17 00:00:00 2001 From: Jim Broadus Date: Sun, 22 Mar 2020 19:59:21 -0700 Subject: [PATCH] Handle redirects when downloading Spotify blob. Use the NoLessSafeRedirectPolicy policy which will redirect as long as it isn't from https to http. --- src/internet/spotify/spotifyblobdownloader.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/internet/spotify/spotifyblobdownloader.cpp b/src/internet/spotify/spotifyblobdownloader.cpp index 3c6339209..037e864a4 100644 --- a/src/internet/spotify/spotifyblobdownloader.cpp +++ b/src/internet/spotify/spotifyblobdownloader.cpp @@ -95,7 +95,13 @@ void SpotifyBlobDownloader::Start() { filename); qLog(Info) << "Downloading" << url; - QNetworkReply* reply = network_->get(QNetworkRequest(url)); + QNetworkRequest req(url); + // This policy will work as long as there isn't a redirect from https to + // http. + req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, + QNetworkRequest::NoLessSafeRedirectPolicy); + + QNetworkReply* reply = network_->get(req); connect(reply, SIGNAL(finished()), SLOT(ReplyFinished())); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(ReplyProgress()));