Connection and websockets fixes

This commit fixes issue around Connection class and websockets
  - controlling connection lifetime by shared_ptr instead of manual new/delete
  - fixed memory leak when upgrading connection to websockets
  - removed dangling reference to conn.req in websockets
  - fixed lack of reponse for invalid websockets URLs
  - fixed not working connections deadline timer

There is no noticable performance impact after switching connection management
to shared pointers. Benchmark results using: wrk https://${bmc}
	shared_ptr: 144.29 Requests/sec
	new/delete: 144.41 Requests/sec

Tested manually:
	performance: wrk https://${bmc}
	memory leaks: top
	websockets: webui- KVM and VirtualMedia
	HTTP GET on random Redfish schemas: postman

Signed-off-by: Jan Sowinski <jan.sowinski@intel.com>
Change-Id: I63f7395ba081a68e7900eae2ed204acd50f58689
diff --git a/http/websocket.h b/http/websocket.h
index 80d536a..f7c818e 100644
--- a/http/websocket.h
+++ b/http/websocket.h
@@ -20,8 +20,8 @@
 struct Connection : std::enable_shared_from_this<Connection>
 {
   public:
-    explicit Connection(const crow::Request& reqIn, crow::Response& res) :
-        req(reqIn), userdataPtr(nullptr){};
+    explicit Connection(const crow::Request& reqIn) :
+        req(reqIn.req), userdataPtr(nullptr){};
 
     virtual void sendBinary(const std::string_view msg) = 0;
     virtual void sendBinary(std::string&& msg) = 0;
@@ -40,7 +40,7 @@
         return userdataPtr;
     }
 
-    crow::Request req;
+    boost::beast::http::request<boost::beast::http::string_body> req;
     crow::Response res;
 
   private:
@@ -51,14 +51,14 @@
 {
   public:
     ConnectionImpl(
-        const crow::Request& reqIn, crow::Response& res, Adaptor adaptorIn,
+        const crow::Request& reqIn, Adaptor adaptorIn,
         std::function<void(Connection&, std::shared_ptr<bmcweb::AsyncResp>)>
             open_handler,
         std::function<void(Connection&, const std::string&, bool)>
             message_handler,
         std::function<void(Connection&, const std::string&)> close_handler,
         std::function<void(Connection&)> error_handler) :
-        Connection(reqIn, res),
+        Connection(reqIn),
         ws(std::move(adaptorIn)), inString(), inBuffer(inString, 131088),
         openHandler(std::move(open_handler)),
         messageHandler(std::move(message_handler)),
@@ -80,12 +80,11 @@
 
         using bf = boost::beast::http::field;
 
-        std::string_view protocol =
-            req.getHeaderValue(bf::sec_websocket_protocol);
+        std::string_view protocol = req[bf::sec_websocket_protocol];
 
         // Perform the websocket upgrade
         ws.async_accept_ex(
-            req.req,
+            req,
             [protocol{std::string(protocol)}](
                 boost::beast::websocket::response_type& m) {
                 if (!protocol.empty())