Fix 302 cache handling
302 cache handling appears to have been broken when we went to AsyncResp
in the connection class instead of using Response directly. This is
because the expected hash was being written to the old response, not the
new one.
Resolve the issue.
Tested:
using curl to grab /redfish/v1
then pull the ETAG from the response
then use curl to set if-none-match
Shows that redfish now responds with 302 not modified.
Loading a browser window shows many requests are fulfilled with 302 not
modified.
Change-Id: Ie1e782fd5b2c6a5bcf942849ee13ca074973bf1e
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 1c24c61..5277981 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -439,7 +439,7 @@
req->getHeaderValue(boost::beast::http::field::if_none_match);
if (!expected.empty())
{
- res.setExpectedHash(expected);
+ asyncResp->res.setExpectedHash(expected);
}
handler->handle(req, asyncResp);
}
diff --git a/http/http_response.hpp b/http/http_response.hpp
index e6c9f72..4f2b0f0 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -76,7 +76,7 @@
Response() = default;
Response(Response&& res) noexcept :
response(std::move(res.response)), jsonValue(std::move(res.jsonValue)),
- completed(res.completed)
+ expectedHash(std::move(res.expectedHash)), completed(res.completed)
{
// See note in operator= move handler for why this is needed.
if (!res.completed)