Skip to content
Snippets Groups Projects
Commit 723f5c49 authored by akiraohgaki's avatar akiraohgaki
Browse files

Follow URL redirection

parent d95bbeb3
No related branches found
No related tags found
No related merge requests found
......@@ -225,7 +225,15 @@ void XdgUrl::_downloaded(QNetworkReply *reply)
return;
}
// If the network reply has a refresh header, retry download
if (reply->hasRawHeader("Location")) {
QString redirectUrl = QString(reply->rawHeader("Location"));
if (redirectUrl.startsWith("/")) {
redirectUrl = reply->url().authority() + redirectUrl;
}
_network->get(QUrl(redirectUrl));
return;
}
if (reply->hasRawHeader("Refresh")) {
QString refreshUrl = QString(reply->rawHeader("Refresh")).split("url=").last();
if (refreshUrl.startsWith("/")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment