diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-13 22:33:12 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-13 22:33:12 +0200 |
commit | cd00813c0740930d389f935f0c2d7d8a11eef02d (patch) | |
tree | ad1d20704e6707b5fcb734876c4a0cbed860c297 /minion/src/wifi_module.cpp | |
parent | fc1a41c627f25c1fa52c87d002d08870fa8876ac (diff) |
refactor(minion): wifi module create http request object in stack
Diffstat (limited to 'minion/src/wifi_module.cpp')
-rw-r--r-- | minion/src/wifi_module.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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<int>(connection_id), request_method, http_version, request_path, |