From 06fc9bebd8c9146636b53f2a04d340230bf21e29 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Wed, 27 Mar 2024 19:58:11 -0700 Subject: Fix regression in http_file_body The commit: b5f288d Make use of filebody for dump offload Caused a minor failure in clearing responses, where open file handles wouldn't be closed in between queries, resulting in the next read to return empty content. This caused redfish protocol validator to fail. boost::beast::http::response::clear() documentation shows that it only clears the headers, not the file body. Now normally, this doesn't matter, because bmcweb completely replaces the response body when a new response is driven, but not in the case of files. Add response.body().clear() during the clear to ensure the response is cleared. In addition, add encodingType to the clear() call, to ensure that it is reset as well. This is a bug, but I don't know the reproduction steps. Tested: Redfish protocol validator now completes (with SSE failures) Change-Id: Ice6d5085003034a1bed48397ddc6316e9cd0536f Signed-off-by: Ed Tanous --- http/http_body.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'http/http_body.hpp') diff --git a/http/http_body.hpp b/http/http_body.hpp index 4b58f213b1..f2ec53fec2 100644 --- a/http/http_body.hpp +++ b/http/http_body.hpp @@ -117,6 +117,7 @@ class HttpBody::value_type strBody.shrink_to_fit(); fileHandle = boost::beast::file_posix(); fileSize = std::nullopt; + encodingType = EncodingType::Raw; } void open(const char* path, boost::beast::file_mode mode, -- cgit v1.2.3