From 9980f27babbb895844921139c57f839c7e84391b Mon Sep 17 00:00:00 2001 From: Linas Valiukas Date: Fri, 20 Dec 2013 19:30:12 +0200 Subject: [PATCH] Set HTTP user agent in order to fix behavior on Qt 5.1 and static files served by sourceforge.net See https://github.com/pypt/fervor/issues/17 for description. --- fvupdater.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fvupdater.cpp b/fvupdater.cpp index 2e5a429..d82c0b4 100644 --- a/fvupdater.cpp +++ b/fvupdater.cpp @@ -289,7 +289,12 @@ void FvUpdater::startDownloadFeed(QUrl url) { m_xml.clear(); - m_reply = m_qnam.get(QNetworkRequest(url)); + QNetworkRequest request; + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/xml"); + request.setHeader(QNetworkRequest::UserAgentHeader, QApplication::applicationName()); + request.setUrl(url); + + m_reply = m_qnam.get(request); connect(m_reply, SIGNAL(readyRead()), this, SLOT(httpFeedReadyRead())); connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(httpFeedUpdateDataReadProgress(qint64, qint64)));