From 1fccd0d5eafd56049a8a381543dd83d5559fbf25 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Tue, 19 Mar 2024 09:16:16 -0700 Subject: Allow no spaces in content-type For the content type header application/json;charset=utf-8 The Redfish specification DSP0266 shows no space between the ; and charset. Sites like mozilla show the space included [1] Considering the discrepancy, we should just accept both. Resolves #271 [1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type Tested: Submitter reports issue fixed. Change-Id: I77b7db91d65acc84f2221ec50985d4b942fbe77f Signed-off-by: Ed Tanous --- http/parsing.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'http') diff --git a/http/parsing.hpp b/http/parsing.hpp index 9a19baf452..cf813537ed 100644 --- a/http/parsing.hpp +++ b/http/parsing.hpp @@ -20,7 +20,9 @@ enum class JsonParseResult inline bool isJsonContentType(std::string_view contentType) { return bmcweb::asciiIEquals(contentType, "application/json") || - bmcweb::asciiIEquals(contentType, "application/json; charset=utf-8"); + bmcweb::asciiIEquals(contentType, + "application/json; charset=utf-8") || + bmcweb::asciiIEquals(contentType, "application/json;charset=utf-8"); } inline JsonParseResult parseRequestAsJson(const crow::Request& req, -- cgit v1.2.3