static int http_prepare_request(CURL *easyhandle, const char *posts, unsigned char request_method, char **error)
size_t zbx_curl_write_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
size_t r_size = size * nmemb;
zbx_http_response_t *response;
response = (zbx_http_response_t*)userdata;
if (ZBX_MAX_RECV_DATA_SIZE < response->offset + r_size)
zbx_str_memcpy_alloc(&response->data, &response->allocated, &response->offset, (const char *)ptr, r_size);
size_t zbx_curl_ignore_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
int zbx_http_prepare_callbacks(CURL *easyhandle, zbx_http_response_t *header, zbx_http_response_t *body,
zbx_curl_cb_t header_cb, zbx_curl_cb_t body_cb, char *errbuf, char **error)
if (CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_HEADERFUNCTION, header_cb)))
*error = zbx_dsprintf(*error, "Cannot set header function: %s", curl_easy_strerror(err));
if (CURLE_OK != (err = curl_easy_setopt(easyhandle, CURLOPT_HEADERDATA, header)))