mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Bug #919905: qBittorrent does not handle redirection to relative URLs correctly
Thanks to luran for providing a first version of this patch.
This commit is contained in:
parent
f06f820047
commit
f6254e9db6
@ -66,9 +66,14 @@ void DownloadThread::processDlFinished(QNetworkReply* reply) {
|
|||||||
const QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
const QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||||
if(redirection.isValid()) {
|
if(redirection.isValid()) {
|
||||||
// We should redirect
|
// We should redirect
|
||||||
qDebug("Redirecting from %s to %s", qPrintable(url), qPrintable(redirection.toUrl().toString()));
|
QUrl newUrl = redirection.toUrl();
|
||||||
m_redirectMapping.insert(redirection.toUrl().toString(), url);
|
// Resolve relative urls
|
||||||
downloadUrl(redirection.toUrl().toString());
|
if (newUrl.isRelative())
|
||||||
|
newUrl = reply->url().resolved(newUrl);
|
||||||
|
const QString newUrlString = newUrl.toString();
|
||||||
|
qDebug("Redirecting from %s to %s", qPrintable(url), qPrintable(newUrlString));
|
||||||
|
m_redirectMapping.insert(newUrlString, url);
|
||||||
|
downloadUrl(newUrlString);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user