diff options
author | Ed Tanous <edtanous@google.com> | 2022-09-22 01:28:04 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2022-09-22 23:37:39 +0300 |
commit | 4a0e1a0cf378e7bf4909c2ea8fc6e77e0d77ca6d (patch) | |
tree | 30e03e09b078d0bb2d1f6812852beb75f0569939 /redfish-core | |
parent | 656472d942f46194bcd6f59c6eca4658fee20c71 (diff) | |
download | bmcweb-4a0e1a0cf378e7bf4909c2ea8fc6e77e0d77ca6d.tar.xz |
Fix content-type return behavior for */*
An HTTP header of Accepts: */* throws a big wrench into our
implementation for a couple reasons. First, because it's the default in
a lot of commonly-used libraries, and second, because clients use it
when they certainly don't mean what the specification says it should
mean "ie, I accept ANY type".
This commit tries to address some of that, by making an explicit option
for content-type="ANY" and pushes it to the individual callers to handle
explicitly as if it were yet another type. In most protocols, there's a
"most common" representation, so protocols are free to use that, or to
explicitly handle it, and require that the user be explicit.
Tested:
Redfish Protocol Validator no longer locks up. (TBD, getting bugs filed
with protocol validator for this missing Accepts header).
For ServiceRoot
GET /redfish/v1 Accepts: application/json - returns json
GET /redfish/v1 Accepts: */* - returns json
GET /redfish/v1 Accepts: text/html - returns html
GET /redfish/v1 no-accepts header - returns json
Redfish-service-validator passes.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iae6711ae587115d3e159a48a6fc46a903ed6c403
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index ffab320cec..d460794672 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -1675,7 +1675,7 @@ inline void requestRoutesDBusEventLogEntryDownload(App& app) } if (http_helpers::isContentTypeAllowed( req.getHeaderValue("Accept"), - http_helpers::ContentType::OctetStream)) + http_helpers::ContentType::OctetStream, true)) { asyncResp->res.result(boost::beast::http::status::bad_request); return; @@ -3495,7 +3495,7 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app) } if (http_helpers::isContentTypeAllowed( req.getHeaderValue("Accept"), - http_helpers::ContentType::OctetStream)) + http_helpers::ContentType::OctetStream, true)) { asyncResp->res.result(boost::beast::http::status::bad_request); return; |