From d9ded26b86e9df8a87f92a5d7ad21f7fbce6edb6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 18 Nov 2015 14:44:07 -0800 Subject: Location service: set user agent string This allows the backend to know which version of Subsurface is contacting it. Signed-off-by: Dirk Hohndel --- qt-mobile/gpslocation.cpp | 3 +++ qt-mobile/gpslocation.h | 1 + 2 files changed, 4 insertions(+) (limited to 'qt-mobile') diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp index f78a482a0..b109a01a3 100644 --- a/qt-mobile/gpslocation.cpp +++ b/qt-mobile/gpslocation.cpp @@ -28,6 +28,7 @@ GpsLocation::GpsLocation(QObject *parent) } else { status("don't have GPS source"); } + userAgent = getUserAgent(); } void GpsLocation::serviceEnable(bool toggle) @@ -95,6 +96,7 @@ QString GpsLocation::getUserid(QString user, QString passwd) data = user + " " + passwd; QNetworkRequest request; request.setUrl(url); + request.setRawHeader("User-Agent", getUserAgent().toUtf8()); request.setRawHeader("Accept", "text/html"); request.setRawHeader("Content-type", "application/x-www-form-urlencoded"); reply = manager->post(request, data.toUtf8()); @@ -299,6 +301,7 @@ void GpsLocation::uploadToServer() status(data.toString(QUrl::FullyEncoded).toUtf8()); QNetworkRequest request; request.setUrl(url); + request.setRawHeader("User-Agent", getUserAgent().toUtf8()); request.setRawHeader("Accept", "text/json"); request.setRawHeader("Content-type", "application/x-www-form-urlencoded"); reply = manager->post(request, data.toString(QUrl::FullyEncoded).toUtf8()); diff --git a/qt-mobile/gpslocation.h b/qt-mobile/gpslocation.h index d00fbae6a..82cab8082 100644 --- a/qt-mobile/gpslocation.h +++ b/qt-mobile/gpslocation.h @@ -24,6 +24,7 @@ private: void status(QString msg); QSettings *geoSettings; QNetworkReply *reply; + QString userAgent; signals: -- cgit v1.2.3-70-g09d2