asterisk: Add macro for curl user agent.

Currently, each module that uses libcurl duplicates the standard
Asterisk curl user agent.

This adds a global macro for the Asterisk user agent used for
curl requests to eliminate this duplication.

ASTERISK-29861 #close

Change-Id: I9fc37935980384b4daf96ae54fa3c9adb962ed2d
This commit is contained in:
Naveen Albert
2022-01-13 14:37:16 +00:00
committed by Kevin Harwell
parent 1633410161
commit e26b57984f
5 changed files with 6 additions and 13 deletions

View File

@@ -54,8 +54,6 @@ static void prometheus_metric_free_wrapper(void *ptr)
}
}
#define GLOBAL_USERAGENT "asterisk-libcurl-agent/1.0"
static struct prometheus_general_config *config_alloc(void)
{
struct prometheus_general_config *config;
@@ -84,7 +82,7 @@ static CURL *get_curl_instance(void)
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 180);
curl_easy_setopt(curl, CURLOPT_USERAGENT, GLOBAL_USERAGENT);
curl_easy_setopt(curl, CURLOPT_USERAGENT, AST_CURL_USER_AGENT);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_URL, server_uri);