Revert "Revert "Connection and websockets fixes""

This reverts commit a8086647b103f55116ce4c872e1455ebf1f3e346.

Reason for revert: Restoring commit c00500b as base for upload image issue fix

Change-Id: I1dd5d3fda2d1ee6f4027193a0506d5ca764b01e4
Signed-off-by: Jan Sowinski <jan.sowinski@intel.com>
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())