#include "async_httpagent.h"
static void httpagent_context_create(zbx_httpagent_context *httpagent_context)
zbx_http_context_create(&httpagent_context->http_context);
void zbx_async_check_httpagent_clean(zbx_httpagent_context *httpagent_context)
zbx_free(httpagent_context->item_context.status_codes);
zbx_free(httpagent_context->item_context.posts);
zbx_http_context_destroy(&httpagent_context->http_context);
int zbx_async_check_httpagent(zbx_dc_item_t *item, AGENT_RESULT *result, const char *config_source_ip,
const char *config_ssl_ca_location, const char *config_ssl_cert_location,
const char *config_ssl_key_location, CURLM *curl_handle)
zbx_httpagent_context *httpagent_context = zbx_malloc(NULL, sizeof(zbx_httpagent_context));
httpagent_context_create(httpagent_context);
httpagent_context->item_context.itemid = item->itemid;
httpagent_context->item_context.hostid = item->host.hostid;
httpagent_context->item_context.value_type = item->value_type;
httpagent_context->item_context.flags = item->flags;
httpagent_context->item_context.state = item->state;
httpagent_context->item_context.posts = item->posts;
httpagent_context->item_context.status_codes = item->status_codes;
item->status_codes = NULL;
if (SUCCEED != zbx_http_request_prepare(&httpagent_context->http_context, item->request_method,
item->url, item->query_fields, item->headers, httpagent_context->item_context.posts,
item->retrieve_mode, item->http_proxy, item->follow_redirects, item->timeout, 1,
item->ssl_cert_file, item->ssl_key_file, item->ssl_key_password, item->verify_peer,
item->verify_host, item->authtype, item->username, item->password, NULL, item->post_type,
item->output_format, config_source_ip, config_ssl_ca_location, config_ssl_cert_location,
config_ssl_key_location, &error))
SET_MSG_RESULT(result, error);