Source
static int vmware_rest_post(const char *fn_parent, CURL *easyhandle, const char *url_suffix, const char *request,
/*
** Copyright (C) 2001-2024 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
typedef struct
{
char *data;
size_t alloc;
size_t offset;
char *url;
}
ZBX_HTTPPAGE_REST;
/******************************************************************************
* *
* Purpose: cURL service function *
* *
******************************************************************************/
static size_t curl_write_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
{
size_t r_size = size * nmemb;
ZBX_HTTPPAGE_REST *page_http = (ZBX_HTTPPAGE_REST *)userdata;
zbx_strncpy_alloc(&page_http->data, &page_http->alloc, &page_http->offset, (const char *)ptr, r_size);
return r_size;
}
/******************************************************************************
* *
* Purpose: cURL service function *
* *
******************************************************************************/
static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
{
ZBX_UNUSED(ptr);
ZBX_UNUSED(userdata);
return size * nmemb;
}