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 <ratagupt@linux.vnet.ibm.com>
Change-Id: I33ca950cedf591f66f4d68514d48d3b9c9fec421
diff --git a/http/routing.h b/http/routing.h
index b2355e9..758f8dd 100644
--- a/http/routing.h
+++ b/http/routing.h
@@ -328,9 +328,13 @@
void handleUpgrade(const Request& req, Response&,
boost::asio::ip::tcp::socket&& adaptor) override
{
- new crow::websocket::ConnectionImpl<boost::asio::ip::tcp::socket>(
- req, std::move(adaptor), openHandler, messageHandler, closeHandler,
- errorHandler);
+ std::shared_ptr<
+ crow::websocket::ConnectionImpl<boost::asio::ip::tcp::socket>>
+ myConnection = std::make_shared<
+ crow::websocket::ConnectionImpl<boost::asio::ip::tcp::socket>>(
+ req, std::move(adaptor), openHandler, messageHandler,
+ closeHandler, errorHandler);
+ myConnection->start();
}
#ifdef BMCWEB_ENABLE_SSL
void handleUpgrade(const Request& req, Response&,