return realsize;
}
-static const char * const global_useragent = "asterisk-libcurl-agent/1.0";
-
static int curl_instance_init(void *data)
{
CURL **curl = 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;
}
#endif
+#define AST_CURL_USER_AGENT "asterisk-libcurl-agent/1.0"
+
#define DEFAULT_LANGUAGE "en"
#define DEFAULT_SAMPLE_RATE 8000
#include "asterisk/threadstorage.h"
#include "asterisk/uri.h"
-#define GLOBAL_USERAGENT "asterisk-libcurl-agent/1.0"
-
#define MAX_HEADER_LENGTH 1023
/*! \brief Data passed to cURL callbacks */
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 180);
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curl_header_callback);
- 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_MAXREDIRS, 8);
curl_easy_setopt(curl, CURLOPT_URL, ast_sorcery_object_get_id(cb_data->bucket_file));
/* Used to check CURL headers */
#define MAX_HEADER_LENGTH 1023
-/* Used for CURL requests */
-#define GLOBAL_USERAGENT "asterisk-libcurl-agent/1.0"
-
/* CURL callback data to avoid storing useless info in AstDB */
struct curl_cb_data {
char *cache_control;
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, curl_timeout);
- 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_HEADERFUNCTION, curl_header_callback);
curl_easy_setopt(curl, CURLOPT_HEADERDATA, data);