From 526ba82b53934e48e7e309b32467f887d579369c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 31 Jul 2014 11:20:11 -0700 Subject: 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 --- qt-ui/updatemanager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'qt-ui/updatemanager.cpp') 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 #include #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() -- cgit v1.2.3-70-g09d2