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
This commit is contained in:
Christian Lohmaier 2024-05-28 14:30:25 +02:00
parent 0d1c8e0427
commit e4b420dfb5

View file

@ -48,6 +48,8 @@
#include <officecfg/Setup.hxx>
#include <vcl/svapp.hxx>
#include <functional>
#include <memory>
#include <set>
@ -71,12 +73,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";
@ -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)
{