Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_splunk: splunk_prot: Fix string in http response code 400. #8980

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions plugins/in_splunk/splunk_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int send_response(struct splunk_conn *conn, int http_status, char *messag
}
else if (http_status == 400) {
flb_sds_printf(&out,
"HTTP/1.1 400 Forbidden\r\n"
"HTTP/1.1 400 Bad Request\r\n"
"Server: Fluent Bit v%s\r\n"
"Content-Length: %i\r\n\r\n%s",
FLB_VERSION_STR,
Expand Down Expand Up @@ -568,7 +568,7 @@ static int process_hec_payload(struct flb_splunk *ctx, struct splunk_conn *conn,
type = HTTP_CONTENT_TEXT;
}
else {
/* Not neccesary to specify content-type for Splunk HEC. */
/* Not necessary to specify content-type for Splunk HEC. */
flb_plg_debug(ctx->ins, "Mark as unknown type for ingested payloads");
type = HTTP_CONTENT_UNKNOWN;
}
Expand Down Expand Up @@ -634,7 +634,7 @@ static int process_hec_raw_payload(struct flb_splunk *ctx, struct splunk_conn *c
}
else if (header->val.len != 10 ||
strncasecmp(header->val.data, "text/plain", 10) != 0) {
/* Not neccesary to specify content-type for Splunk HEC. */
/* Not necessary to specify content-type for Splunk HEC. */
flb_plg_debug(ctx->ins, "Mark as unknown type for ingested payloads");
}

Expand Down Expand Up @@ -776,7 +776,7 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn,
}

if (request->method == MK_METHOD_GET) {
/* Handle health minotoring of splunk hec endpoint for load balancers */
/* Handle health monitoring of splunk hec endpoint for load balancers */
if (strcasecmp(uri, "/services/collector/health") == 0) {
send_json_message_response(conn, 200, "{\"text\":\"Success\",\"code\":200}");
}
Expand All @@ -794,7 +794,7 @@ int splunk_prot_handle(struct flb_splunk *ctx, struct splunk_conn *conn,
* authentication if provided splunk_token */
ret = validate_auth_header(ctx, request);
if (ret < 0){
send_response(conn, 401, "error: unauthroized\n");
send_response(conn, 401, "error: unauthorized\n");
if (ret == SPLUNK_AUTH_MISSING_CRED) {
flb_plg_warn(ctx->ins, "missing credentials in request headers");
}
Expand Down Expand Up @@ -889,7 +889,7 @@ static int send_response_ng(struct flb_http_response *response,
flb_http_response_set_message(response, "No Content");
}
else if (http_status == 400) {
flb_http_response_set_message(response, "Forbidden");
flb_http_response_set_message(response, "Bad Request");
}

if (message != NULL) {
Expand Down Expand Up @@ -919,7 +919,7 @@ static int send_json_message_response_ng(struct flb_http_response *response,
flb_http_response_set_message(response, "No Content");
}
else if (http_status == 400) {
flb_http_response_set_message(response, "Forbidden");
flb_http_response_set_message(response, "Bad Request");
}

flb_http_response_set_header(response,
Expand Down Expand Up @@ -993,7 +993,7 @@ static int process_hec_payload_ng(struct flb_http_request *request,
type = HTTP_CONTENT_TEXT;
}
else {
/* Not neccesary to specify content-type for Splunk HEC. */
/* Not necessary to specify content-type for Splunk HEC. */
flb_plg_debug(ctx->ins, "Mark as unknown type for ingested payloads");
}
}
Expand Down Expand Up @@ -1029,7 +1029,7 @@ static int process_hec_raw_payload_ng(struct flb_http_request *request,
return -1;
}
else if (strcasecmp(request->content_type, "text/plain") != 0) {
/* Not neccesary to specify content-type for Splunk HEC. */
/* Not necessary to specify content-type for Splunk HEC. */
flb_plg_debug(ctx->ins, "Mark as unknown type for ingested payloads");
}

Expand Down Expand Up @@ -1072,7 +1072,7 @@ int splunk_prot_handle_ng(struct flb_http_request *request,
}

if (request->method == HTTP_METHOD_GET) {
/* Handle health minotoring of splunk hec endpoint for load balancers */
/* Handle health monitoring of splunk hec endpoint for load balancers */
if (strcasecmp(request->path, "/services/collector/health") == 0) {
send_json_message_response_ng(response, 200, "{\"text\":\"Success\",\"code\":200}");
}
Expand Down
Loading