Skip to content

Commit

Permalink
Set HTTP user agent in order to fix behavior on Qt 5.1 and static fil…
Browse files Browse the repository at this point in the history
…es served by sourceforge.net

See #17 for description.
  • Loading branch information
pypt committed Dec 20, 2013
1 parent b965e26 commit 9980f27
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fvupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

This comment has been minimized.

Copy link
@mamayer

mamayer Feb 17, 2015

QNetworkRequest::UserAgentHeader doesn't exisit in Qt4.

Line 294 should be replaced with:

#if QT_VERSION >= 0x050000
    request.setHeader(QNetworkRequest::UserAgentHeader, QApplication::applicationName());
#else
    request.setRawHeader("User-Agent", QApplication::applicationName().toAscii());
#endif
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)));
Expand Down

0 comments on commit 9980f27

Please sign in to comment.