diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-07-31 11:20:11 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-31 11:20:11 -0700 |
commit | 526ba82b53934e48e7e309b32467f887d579369c (patch) | |
tree | 27f9655030f0e07d8cc307fac85ff8fa9cea9617 /qt-ui/updatemanager.cpp | |
parent | ebdeddb9b93772574460f19bed9fe43d242d8f16 (diff) | |
download | subsurface-526ba82b53934e48e7e309b32467f887d579369c.tar.gz |
Give Subsurface a distinct User Agent string
When accessing websites (divelogs.de, subsurface website) we shouldn't
pretend to be Mozilla 5.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/updatemanager.cpp')
-rw-r--r-- | qt-ui/updatemanager.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp index f92eeb873..47554fcc5 100644 --- a/qt-ui/updatemanager.cpp +++ b/qt-ui/updatemanager.cpp @@ -1,4 +1,5 @@ #include "updatemanager.h" +#include "usersurvey.h" #include <QtNetwork> #include <QMessageBox> #include "subsurfacewebservices.h" @@ -24,7 +25,12 @@ void UpdateManager::checkForUpdates() QString version = VERSION_STRING; QString url = QString("http://subsurface.hohndel.org/updatecheck.html?os=%1&ver=%2").arg(os, version); - connect(SubsurfaceWebServices::manager()->get(QNetworkRequest(QUrl(url))), SIGNAL(finished()), this, SLOT(requestReceived())); + QNetworkRequest request; + request.setUrl(url); + request.setRawHeader("Accept", "text/xml"); + QString userAgent = UserSurvey::getVersion().replace("\n", " "); + request.setRawHeader("User-Agent", userAgent.toUtf8()); + connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived())); } void UpdateManager::requestReceived() |