From 15a4e4045c570908136f3a9f69637ee0d542478c Mon Sep 17 00:00:00 2001 From: Phillip Adair Stewart Whelan Date: Thu, 25 Sep 2025 17:58:41 -0300 Subject: [PATCH 1/2] in_splunk: return correct error response for http/1 handler. Signed-off-by: Phillip Adair Stewart Whelan --- plugins/in_splunk/splunk_prot.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/in_splunk/splunk_prot.c b/plugins/in_splunk/splunk_prot.c index d55433f6b85..2f707fdbde3 100644 --- a/plugins/in_splunk/splunk_prot.c +++ b/plugins/in_splunk/splunk_prot.c @@ -887,10 +887,11 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn, return -1; } - if (!ret) { + if (ret < 0) { send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}"); + } else { + send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } - send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } else if (strcasecmp(uri, "/services/collector/event/1.0") == 0 || strcasecmp(uri, "/services/collector/event") == 0 || @@ -910,10 +911,11 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn, return -1; } - if (!ret) { + if (ret < 0) { send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}"); + } else { + send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } - send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}"); } else { send_response(conn, 400, "error: invalid HTTP endpoint\n"); From 33accc1d2cdb6202a601033964ae15bc5826ef95 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Thu, 25 Sep 2025 22:06:35 -0300 Subject: [PATCH 2/2] in_splunk: return correct error response for http/1 handler. Signed-off-by: Phillip Whelan --- plugins/in_splunk/splunk_prot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/in_splunk/splunk_prot.c b/plugins/in_splunk/splunk_prot.c index 2f707fdbde3..af0ebc0c02b 100644 --- a/plugins/in_splunk/splunk_prot.c +++ b/plugins/in_splunk/splunk_prot.c @@ -642,7 +642,7 @@ static int process_hec_payload(struct flb_splunk *ctx, struct splunk_conn *conn, ret = handle_hec_payload(ctx, type, tag, request->data.data, request->data.len); } - return 0; + return ret; } static int process_hec_raw_payload(struct flb_splunk *ctx, struct splunk_conn *conn,