Source
static int vmware_rest_post(const char *fn_parent, CURL *easyhandle, const char *url_suffix, const char *request,
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
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;