35 #define BUFFER_LEN 1024 37 static size_t file_callback(
void *ptr,
size_t size,
size_t nmemb,
void *data)
39 register unsigned int realsize = (
unsigned int)(size * nmemb);
53 register unsigned int realsize = (
unsigned int)(size * nmemb);
59 header[realsize] =
'\0';
83 char *content_type_res = NULL;
91 if (curl_connect_timeout == 0) curl_connect_timeout = 3;
92 if (curl_timeout == 0) curl_timeout = 30;
97 if (!strncasecmp(url,
"https", 5)) {
131 http_data->
code = http_res;
switch_curl_slist_t * headers
#define SWITCH_CHANNEL_LOG
switch_status_t switch_buffer_create_dynamic(_Out_ switch_buffer_t **buffer, _In_ switch_size_t blocksize, _In_ switch_size_t start_len, _In_ switch_size_t max_len)
Allocate a new dynamic switch_buffer.
switch_CURLcode perform_code
switch_CURLcode switch_curl_easy_getinfo(switch_CURL *curl, switch_CURLINFO info,...)
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
switch_memory_pool_t * pool
switch_CURL * switch_curl_easy_init(void)
switch_CURLcode switch_curl_easy_perform(switch_CURL *handle)
http_data_t * xswitch_http_post(const char *url, const char *data, switch_memory_pool_t *pool)
switch_buffer_t * body_buffer
switch_size_t switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen)
Write data into a switch_buffer_t up to the length of datalen.
void switch_curl_easy_cleanup(switch_CURL *handle)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
switch_curl_slist_t * switch_curl_slist_append(switch_curl_slist_t *list, const char *string)
http_data_t * xswitch_http_request(int method, const char *url, const void *data, size_t datalen, switch_curl_slist_t *headers, switch_memory_pool_t *pool, int curl_connect_timeout, int curl_timeout)
http_data_t * xswitch_http_get(const char *url, switch_memory_pool_t *pool)
static size_t header_callback(void *ptr, size_t size, size_t nmemb, void *data)
SWITCH_BEGIN_EXTERN_C typedef void switch_CURL
struct curl_slist switch_curl_slist_t
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
switch_CURLcode switch_curl_easy_setopt(CURL *handle, switch_CURLoption option,...)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
switch_memory_pool_t * pool
void switch_curl_slist_free_all(switch_curl_slist_t *list)
static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
switch_size_t switch_buffer_inuse(_In_ switch_buffer_t *buffer)
Get the in use amount of a switch_buffer_t.