Add asyncResp support to handleUpgrade
This commit enables passing down the asyncResp (of the connection) to
the handler of upgraded connections. This is already in place for normal
requests (i.e. Class Router -> handle())
This change would enable any async calls that would be required before
upgrade of the connection. For example, as on today, we have only
Authentication of user in place for upgraded connection, but not
Authorization. So, this asyncResp could further be used for such dbus
calls to return informative response.
This commit updates the signature of all the handleUpgrade() functions
present in router.hpp to take in asyncResp object instead of normal
response.
Tested :
- websocket_test.py Passed
- KVM was functional in WebUI.
Change-Id: I1c6c91f126b734e1b5573d5ef204fe2bf6ed6c26
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
diff --git a/http/app.hpp b/http/app.hpp
index d3afe60..a2892ce 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -58,9 +58,11 @@
App& operator=(const App&&) = delete;
template <typename Adaptor>
- void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor)
+ void handleUpgrade(const Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ Adaptor&& adaptor)
{
- router.handleUpgrade(req, res, std::forward<Adaptor>(adaptor));
+ router.handleUpgrade(req, asyncResp, std::forward<Adaptor>(adaptor));
}
void handle(Request& req,