From c0cec3ac5b0c928c21fc41aacd2044c4e8b96505 Mon Sep 17 00:00:00 2001 From: tszshingt <55681122+tszshingt@users.noreply.github.com> Date: Wed, 17 May 2023 03:21:39 -0500 Subject: [PATCH] in_http: fix parser memory reinitialization This fixes the reinitialization of the parser with the size of the parser structure instead of the size of a pointer. The original code appeared to be a typo and prevented the build for Windows with this plugin. Additionally, it enables the http input plugin plugin in Windows. Note: this is a backport of #7407 Signed-off-by: Shing Tsoi --- cmake/windows-setup.cmake | 2 +- plugins/in_http/http_conn.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/windows-setup.cmake b/cmake/windows-setup.cmake index 11fb72a8301..37c3ebbe9cb 100644 --- a/cmake/windows-setup.cmake +++ b/cmake/windows-setup.cmake @@ -26,7 +26,7 @@ if(FLB_WINDOWS_DEFAULTS) set(FLB_IN_EXEC_WASI No) set(FLB_IN_FORWARD Yes) set(FLB_IN_HEALTH No) - set(FLB_IN_HTTP No) + set(FLB_IN_HTTP Yes) set(FLB_IN_MEM No) set(FLB_IN_KMSG No) set(FLB_IN_LIB Yes) diff --git a/plugins/in_http/http_conn.c b/plugins/in_http/http_conn.c index d2d96b8da22..54b58311f38 100644 --- a/plugins/in_http/http_conn.c +++ b/plugins/in_http/http_conn.c @@ -134,7 +134,7 @@ static int http_conn_event(void *data) * handled, the additional memset intends to wipe any left over data * from the headers parsed in the previous request. */ - memset(&conn->session.parser, 0, sizeof(mk_http_parser)); + memset(&conn->session.parser, 0, sizeof(struct mk_http_parser)); mk_http_parser_init(&conn->session.parser); http_conn_request_init(&conn->session, &conn->request); } @@ -146,7 +146,7 @@ static int http_conn_event(void *data) * handled, the additional memset intends to wipe any left over data * from the headers parsed in the previous request. */ - memset(&conn->session.parser, 0, sizeof(mk_http_parser)); + memset(&conn->session.parser, 0, sizeof(struct mk_http_parser)); mk_http_parser_init(&conn->session.parser); http_conn_request_init(&conn->session, &conn->request); }