Source
zbx_strncpy_alloc(&request->headers_in, &request->headers_in_alloc, &request->headers_in_offset, (const char *)ptr, r_size);
/*
** 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 envied 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.
**/
extern char *CONFIG_SOURCE_IP;
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'. */