diff options
author | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2019-10-22 12:13:36 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-10-23 20:33:36 +0300 |
commit | 02453b10810c2775236fd0ea4e2d7bc14c46645f (patch) | |
tree | cdde827652a21868672377129df92a60f13738c2 /http/routing.h | |
parent | 717794d5465c54e07a1247db9e9d7ec68b0d6cc6 (diff) | |
download | bmcweb-02453b10810c2775236fd0ea4e2d7bc14c46645f.tar.xz |
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
Diffstat (limited to 'http/routing.h')
-rw-r--r-- | http/routing.h | 10 |
1 files changed, 7 insertions, 3 deletions
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<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&, |