Skip to content

Commit

Permalink
Updated http_prot to handle json content type header with charset or …
Browse files Browse the repository at this point in the history
…without.

Signed-off-by: metalfork <[email protected]>
  • Loading branch information
metalfork committed Aug 13, 2024
1 parent 91f6411 commit 8b0df78
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/in_http/http_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,8 @@ static int process_payload(struct flb_http *ctx, struct http_conn *conn,
return -1;
}

if (header->val.len >= 16 &&
(strncasecmp(header->val.data, "application/json ", 17) == 0 ||
strncasecmp(header->val.data, "application/json;", 17) == 0)) {
if ((header->val.len == 16 && strncasecmp(header->val.data, "application/json", 16) == 0) ||
(header->val.len > 16 && (strncasecmp(header->val.data, "application/json ", 17) == 0) || strncasecmp(header->val.data, "application/json;", 17) == 0)) {
type = HTTP_CONTENT_JSON;
}

Expand Down

0 comments on commit 8b0df78

Please sign in to comment.