Source
zbx_strncpy_alloc(&request->headers_in, &request->headers_in_alloc, &request->headers_in_offset, (const char *)ptr, r_size);
/*
** Copyright (C) 2001-2025 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
{
CURL *handle;
struct curl_slist *headers;
char *data;
char *headers_in;
size_t data_alloc;
size_t data_offset;
size_t headers_in_alloc;
size_t headers_in_offset;
unsigned char custom_header;
size_t headers_sz;
}
zbx_es_httprequest_t;
/* ZBX_CURL_SETOPT() macro is a code snippet to make code shorter and facilitate resource deallocation */
/* in case of error. Be careful with using ZBX_CURL_SETOPT(), duk_push_error_object() and duk_error() */
/* in functions - it is easy to get memory leaks because duk_error() causes longjmp(). */
/* Note that the caller of ZBX_CURL_SETOPT() must define variable 'int err_index' and label 'out'. */