mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
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:
@@ -600,8 +600,6 @@ static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *da
|
||||
return realsize;
|
||||
}
|
||||
|
||||
static const char * const global_useragent = "asterisk-libcurl-agent/1.0";
|
||||
|
||||
static int curl_instance_init(void *data)
|
||||
{
|
||||
CURL **curl = data;
|
||||
@@ -612,7 +610,7 @@ static int curl_instance_init(void *data)
|
||||
curl_easy_setopt(*curl, CURLOPT_NOSIGNAL, 1);
|
||||
curl_easy_setopt(*curl, CURLOPT_TIMEOUT, 180);
|
||||
curl_easy_setopt(*curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
|
||||
curl_easy_setopt(*curl, CURLOPT_USERAGENT, global_useragent);
|
||||
curl_easy_setopt(*curl, CURLOPT_USERAGENT, AST_CURL_USER_AGENT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user