From 02453b10810c2775236fd0ea4e2d7bc14c46645f Mon Sep 17 00:00:00 2001 From: Ratan Gupta Date: Tue, 22 Oct 2019 14:43:36 +0530 Subject: Fix the websocket handshake If bmcweb is compiled with NON SSL mode then HTTP/websocket connection upgrade was not happening This commit fixes this behavior TestedBy: Sent a websocket request in non secure mode and the websocket handshake was working ws://{ip}/vm/0/0 to verify this Signed-off-by: Ratan Gupta Change-Id: I33ca950cedf591f66f4d68514d48d3b9c9fec421 --- http/routing.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'http/routing.h') diff --git a/http/routing.h b/http/routing.h index b2355e9540..758f8dd4d7 100644 --- a/http/routing.h +++ b/http/routing.h @@ -328,9 +328,13 @@ class WebSocketRule : public BaseRule void handleUpgrade(const Request& req, Response&, boost::asio::ip::tcp::socket&& adaptor) override { - new crow::websocket::ConnectionImpl( - req, std::move(adaptor), openHandler, messageHandler, closeHandler, - errorHandler); + std::shared_ptr< + crow::websocket::ConnectionImpl> + myConnection = std::make_shared< + crow::websocket::ConnectionImpl>( + req, std::move(adaptor), openHandler, messageHandler, + closeHandler, errorHandler); + myConnection->start(); } #ifdef BMCWEB_ENABLE_SSL void handleUpgrade(const Request& req, Response&, -- cgit v1.2.3