summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-05-28 14:30:25 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-06-06 16:00:33 +0200
commite4b420dfb57dec361032cf1fb1fe47cc69b46358 (patch)
tree2ec344a6a00b490c1022b0f5f14aae39e780b30d /desktop/source
parent0d1c8e0427756414d3296b06a6f2c0e7b96ba250 (diff)
mar: use OS version in User-Agent
this will allow the server to handle cases when we have to drop support for older versions of Windows for example Change-Id: I13f85a97179df6aa91e00853dbf6576d78854061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168152 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/app/updater.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index d60c006f6b6f..39810c2cbbdc 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -48,6 +48,8 @@
#include <officecfg/Setup.hxx>
+#include <vcl/svapp.hxx>
+
#include <functional>
#include <memory>
#include <set>
@@ -72,12 +74,6 @@ public:
};
#ifdef UNX
-static const char kUserAgent[] = "LibreOffice UpdateChecker/1.0 (Linux)";
-#else
-static const char kUserAgent[] = "LibreOffice UpdateChecker/1.0 (unknown platform)";
-#endif
-
-#ifdef UNX
const char* const pUpdaterName = "updater";
const char* const pSofficeExeName = "soffice";
#elif defined(_WIN32)
@@ -562,10 +558,14 @@ std::string download_content(const OString& rURL, bool bFile, OUString& rHash)
if (!curl)
return std::string();
+ static const OUString kUserAgent
+ = u"LibreOffice UpdateChecker/1.0 (os_version)"_ustr.replaceFirst(
+ "os_version", Application::GetOSVersion());
+
::InitCurl_easy(curl.get());
curl_easy_setopt(curl.get(), CURLOPT_URL, rURL.getStr());
- curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, kUserAgent);
+ curl_easy_setopt(curl.get(), CURLOPT_USERAGENT, kUserAgent.toUtf8().getStr());
bool bUseProxy = false;
if (bUseProxy)
{