Revert "Connection and websockets fixes"
This reverts commit c00500bcb9c5145f5cacb78bbe3dd694fb85ba0a.
Reason: Makes image upload fail
Tested: Image upload works again
requests.post(
'https://{}/redfish/v1/UpdateService'.format(args.address),
data=file.read(), verify=False,
auth=(args.username, args.password))
Change-Id: Iaf780d052d98accdead32e87f468002f5141b19a
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/http/websocket.h b/http/websocket.h
index f7c818e..80d536a 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) :
- req(reqIn.req), userdataPtr(nullptr){};
+ explicit Connection(const crow::Request& reqIn, crow::Response& res) :
+ req(reqIn), userdataPtr(nullptr){};
virtual void sendBinary(const std::string_view msg) = 0;
virtual void sendBinary(std::string&& msg) = 0;
@@ -40,7 +40,7 @@
return userdataPtr;
}
- boost::beast::http::request<boost::beast::http::string_body> req;
+ crow::Request req;
crow::Response res;
private:
@@ -51,14 +51,14 @@
{
public:
ConnectionImpl(
- const crow::Request& reqIn, Adaptor adaptorIn,
+ const crow::Request& reqIn, crow::Response& res, 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),
+ Connection(reqIn, res),
ws(std::move(adaptorIn)), inString(), inBuffer(inString, 131088),
openHandler(std::move(open_handler)),
messageHandler(std::move(message_handler)),
@@ -80,11 +80,12 @@
using bf = boost::beast::http::field;
- std::string_view protocol = req[bf::sec_websocket_protocol];
+ std::string_view protocol =
+ req.getHeaderValue(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())