Skip to content

Commit 1919494

Browse files
pwhelanedsiper
authored andcommitted
in_splunk: return correct error response for http/1 handler.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent de3dc06 commit 1919494

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

plugins/in_splunk/splunk_prot.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,12 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn,
887887
return -1;
888888
}
889889

890-
if (!ret) {
890+
if (ret < 0) {
891891
send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}");
892892
}
893-
send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}");
893+
else {
894+
send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}");
895+
}
894896
}
895897
else if (strcasecmp(uri, "/services/collector/event/1.0") == 0 ||
896898
strcasecmp(uri, "/services/collector/event") == 0 ||
@@ -910,10 +912,12 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn,
910912
return -1;
911913
}
912914

913-
if (!ret) {
915+
if (ret < 0) {
914916
send_json_message_response(conn, 400, "{\"text\":\"Invalid data format\",\"code\":6}");
915917
}
916-
send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}");
918+
else {
919+
send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":0}");
920+
}
917921
}
918922
else {
919923
send_response(conn, 400, "error: invalid HTTP endpoint\n");
@@ -1268,4 +1272,4 @@ int splunk_prot_handle_ng(struct flb_http_request *request,
12681272

12691273
flb_sds_destroy(tag);
12701274
return ret;
1271-
}
1275+
}

0 commit comments

Comments
 (0)