From c8925e0f667b0c94028345586d99008066358200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 7 Aug 2013 01:49:19 +0200 Subject: [PATCH] Fix LWJGL downloader - works conssistently now. --- backend/LegacyUpdate.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/LegacyUpdate.cpp b/backend/LegacyUpdate.cpp index 533be468..ff42e52d 100644 --- a/backend/LegacyUpdate.cpp +++ b/backend/LegacyUpdate.cpp @@ -34,10 +34,11 @@ void LegacyUpdate::lwjglStart() } lwjglVersion = version->name(); QString url = version->url(); - + QUrl realUrl(url); + QString hostname = realUrl.host(); auto &worker = NetWorker::spawn(); - QNetworkRequest req(url); - req.setRawHeader("Host", "sourceforge.net"); + QNetworkRequest req(realUrl); + req.setRawHeader("Host", hostname.toLatin1()); req.setHeader(QNetworkRequest::UserAgentHeader, "Wget/1.14 (linux-gnu)"); QNetworkReply * rep = worker.get ( req ); @@ -74,8 +75,10 @@ void LegacyUpdate::lwjglFinished(QNetworkReply* reply) { auto &worker = NetWorker::spawn(); QString redirectedTo = reply->header(QNetworkRequest::LocationHeader).toString(); + QUrl realUrl(redirectedTo); + QString hostname = realUrl.host(); QNetworkRequest req(redirectedTo); - req.setRawHeader("Host", "sourceforge.net"); + req.setRawHeader("Host", hostname.toLatin1()); req.setHeader(QNetworkRequest::UserAgentHeader, "Wget/1.14 (linux-gnu)"); QNetworkReply * rep = worker.get(req); connect(rep, SIGNAL(downloadProgress(qint64,qint64)), SLOT(updateDownloadProgress(qint64,qint64)));