From cd00813c0740930d389f935f0c2d7d8a11eef02d Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 13 May 2022 22:33:12 +0200 Subject: refactor(minion): wifi module create http request object in stack --- minion/src/wifi_module.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'minion/src/wifi_module.cpp') diff --git a/minion/src/wifi_module.cpp b/minion/src/wifi_module.cpp index 2f4e57c..dbcd737 100644 --- a/minion/src/wifi_module.cpp +++ b/minion/src/wifi_module.cpp @@ -228,13 +228,13 @@ auto WiFiModule::get_local_ip(char *local_ip_out) noexcept -> const char * return local_ip_out; } -auto WiFiModule::read_incoming_request() noexcept -> HTTPRequest * +auto WiFiModule::read_incoming_request() noexcept -> HTTPRequest { char request_prefix[] = "+IPD,"; if (get_available() == 0 || !_serial.find(request_prefix)) { - return nullptr; + return HTTPRequest::create_invalid(); } const auto min_available_bytes = 5; @@ -273,15 +273,15 @@ auto WiFiModule::read_incoming_request() noexcept -> HTTPRequest * if (request_data == nullptr) { - return nullptr; + return HTTPRequest::create_invalid(); } strcpy(request_data, ""); _read_bytes(request_data, request_data_length, TIMEOUT_LONG); - return new HTTPRequest( - connection_id, + return HTTPRequest( + static_cast(connection_id), request_method, http_version, request_path, -- cgit v1.2.3-18-g5258