1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Minimize data sent in the default user agent (#14851)

This commit is contained in:
sfan5 2024-07-20 10:27:04 +02:00 committed by GitHub
parent eba0806d77
commit a7a719261e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 6 deletions

View file

@ -40,10 +40,17 @@ static std::unordered_map<u64, std::queue<HTTPFetchResult>>
g_httpfetch_results;
static PcgRandom g_callerid_randomness;
static std::string default_user_agent()
{
std::string ret(PROJECT_NAME_C "/");
ret.append(g_version_string).append(" (").append(porting::get_sysinfo()).append(")");
return ret;
}
HTTPFetchRequest::HTTPFetchRequest() :
timeout(g_settings->getS32("curl_timeout")),
connect_timeout(10 * 1000),
useragent(std::string(PROJECT_NAME_C "/") + g_version_hash + " (" + porting::get_sysinfo() + ")")
useragent(default_user_agent())
{
timeout = std::max(timeout, MIN_HTTPFETCH_TIMEOUT_INTERACTIVE);
}