diff options
author | Jan Sowinski <jan.sowinski@intel.com> | 2020-01-09 16:28:32 +0000 |
---|---|---|
committer | Jan Sowinski <jan.sowinski@intel.com> | 2020-01-09 16:28:32 +0000 |
commit | ee52ae1013244b73d8312d5f7e795bb01f3c1089 (patch) | |
tree | 144f10f58f0794b87134be0ac862f92ece6e93d7 /http/websocket.h | |
parent | a8086647b103f55116ce4c872e1455ebf1f3e346 (diff) | |
download | bmcweb-ee52ae1013244b73d8312d5f7e795bb01f3c1089.tar.gz bmcweb-ee52ae1013244b73d8312d5f7e795bb01f3c1089.zip |
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>
Diffstat (limited to 'http/websocket.h')
-rw-r--r-- | http/websocket.h | 15 |
1 files changed, 7 insertions, 8 deletions
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 @@ namespace websocket 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 @@ struct Connection : std::enable_shared_from_this<Connection> return userdataPtr; } - crow::Request req; + boost::beast::http::request<boost::beast::http::string_body> req; crow::Response res; private: @@ -51,14 +51,14 @@ template <typename Adaptor> class ConnectionImpl : public Connection { 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 @@ template <typename Adaptor> class ConnectionImpl : public Connection 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()) |