diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/LegacyUpdate.cpp | 11 |
1 files 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))); |