fix(userspace/falco): accept 'Content-Type' header that contains "application/json", but it is not strictly equal to it.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
This commit is contained in:
Federico Di Pierro 2021-11-19 17:19:45 +01:00 committed by poiana
parent 9dcd8bccac
commit b359f71511

View File

@ -150,7 +150,7 @@ bool k8s_audit_handler::handlePost(CivetServer *server, struct mg_connection *co
// Ensure that the content-type is application/json
const char *ct = server->getHeader(conn, string("Content-Type"));
if(ct == NULL || string(ct) != "application/json")
if(ct == NULL || strstr(ct, "application/json") == NULL)
{
mg_send_http_error(conn, 400, "Wrong Content Type");