summaryrefslogtreecommitdiff
path: root/http/http_request.hpp
diff options
context:
space:
mode:
authorJohn Edward Broadbent <jebr@google.com>2021-07-14 01:36:32 +0300
committerEd Tanous <ed@tanous.net>2021-09-09 05:22:38 +0300
commit59b98b2222fddbea3d6f678d9e94006521f0c381 (patch)
tree44a79228f34c6ae0ce2b333c2f524256f8469872 /http/http_request.hpp
parent7bb985eeb0930905c2f4d551e895dd5293094931 (diff)
downloadbmcweb-59b98b2222fddbea3d6f678d9e94006521f0c381.tar.xz
Change ownership of boost::req to crow::req
req is being created later, in the connection life cycle. req was holding many important values when it was passed to authenticate, so the authenticate call had to be refactored to includes all the data req was holding. Also uses of req before handle have been changed to direct calls to boot::parse Tested: Made a request that did not require authentication $ curl -vvvv --insecure "https://192.168.7.2:18080/redfish/v1" Got correct service root Made a unauthenticated request (Chassis) $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET https://192.168.7.2:18080/redfish/v1/Chassis Unauthenticated Made a log-in request $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST https://192.168.7.2:18080/login -d "{\"data\": [ \"root\", \"0penBmc\" ] }" Made (same) Chassis request $ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET https://192.168.7.2:18080/redfish/v1/Chassis Tested the websockets using scripts/websocket_test.py Websockets continued to work after this change. Followed the mTLS instructions here https://github.com/openbmc/docs/blob/master/security/TLS-configuration.md mTLS continues to work after this change. Change-Id: I78f78063be0331be00b66349d5d184847add1708 Signed-off-by: John Edward Broadbent <jebr@google.com>
Diffstat (limited to 'http/http_request.hpp')
-rw-r--r--http/http_request.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/http/http_request.hpp b/http/http_request.hpp
index 44ed2e30f5..fecb9de3fb 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -18,7 +18,7 @@ namespace crow
struct Request
{
- boost::beast::http::request<boost::beast::http::string_body>& req;
+ boost::beast::http::request<boost::beast::http::string_body> req;
boost::beast::http::fields& fields;
std::string_view url{};
boost::urls::url_view urlView{};
@@ -34,9 +34,9 @@ struct Request
std::string userRole{};
Request(
- boost::beast::http::request<boost::beast::http::string_body>& reqIn) :
- req(reqIn),
- fields(reqIn.base()), body(reqIn.body())
+ boost::beast::http::request<boost::beast::http::string_body> reqIn) :
+ req(std::move(reqIn)),
+ fields(req.base()), body(req.body())
{}
boost::beast::http::verb method() const