Skip to content

Commit

Permalink
Get it compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Feb 3, 2025
1 parent adf6aef commit cd0bcaf
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
6 changes: 3 additions & 3 deletions include/external/AsyncWebServer/HttpRequestBodyParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class HttpRequestBodyParser {

HttpMethod method() const { return _method; }
HttpVersion version() const { return _version; }
HttpVersion versionMajor() const { return _version.major; }
HttpVersion versionMinor() const { return _version.minor; }
uint8_t versionMajor() const { return _version.major; }
uint8_t versionMinor() const { return _version.minor; }
std::string_view url() const { return _url; }
const std::map<std::string, std::string>& queryParams() const { return _queryParams; }
const std::map<std::string, std::string>& headers() const { return _headers; }
Expand All @@ -39,4 +39,4 @@ class HttpRequestBodyParser {
std::string _url;
std::map<std::string, std::string> _queryParams;
std::map<std::string, std::string> _headers;
}
};
2 changes: 2 additions & 0 deletions src/external/AsyncWebServer/HttpRequestBodyParser.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <freertos/FreeRTOS.h>

#include "external/AsyncWebServer/HttpRequestBodyParser.h"

#include "Convert.h"
Expand Down
2 changes: 2 additions & 0 deletions src/external/AsyncWebServer/WebHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <freertos/FreeRTOS.h>

#include "external/AsyncWebServer/ESPAsyncWebServer.h"
#include "external/AsyncWebServer/WebHandlerImpl.h"

Expand Down
36 changes: 13 additions & 23 deletions src/external/AsyncWebServer/WebRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <freertos/FreeRTOS.h>

#include "external/AsyncWebServer/ESPAsyncWebServer.h"
#include "external/AsyncWebServer/WebResponseImpl.h"

Expand Down Expand Up @@ -129,8 +131,9 @@ AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer* s, AsyncClient* c)
, _server(s)
, _handler(NULL)
, _response(NULL)
, _onDisconnectfn(nullptr)
, _temp()
, _parseState(0)
, _parseState((HttpParseState)0)
, _version {}
, _method(HTTP_ANY)
, _url()
Expand All @@ -156,7 +159,7 @@ AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer* s, AsyncClient* c)
, _itemFilename()
, _itemType()
, _itemValue()
, _itemBuffer(0)
, _itemBuffer(nullptr)
, _itemBufferIndex(0)
, _itemIsFile(false)
, _tempObject(NULL)
Expand Down Expand Up @@ -442,7 +445,7 @@ bool AsyncWebServerRequest::_parseReqHeader(std::string_view header)
_contentType = OpenShock::StringBeforeFirst(pair.second, ';');
if (OpenShock::StringHasPrefix(_contentType, "multipart/"sv)) {
_boundary = OpenShock::StringAfterFirst(pair.second, '=');
_boundary.replace("\"", ""); // TODO: Optimize this by merging with string_view assignment
_boundary.erase(std::remove(_boundary.begin(), _boundary.end(), '"'), _boundary.end()); // TODO: Optimize this by merging with string_view assignment
_isMultipart = true;
}
} else if (OpenShock::StringIEquals(pair.first, "Content-Length"sv)) {
Expand Down Expand Up @@ -594,28 +597,15 @@ void AsyncWebServerRequest::_parseMultipartPostByte(uint8_t data, bool last)
} else {
std::string_view key = view.substr(0, equalsPos);
std::string_view value = view.substr(equalsPos + 1);

if (key == "name"sv) {
_itemName = value;
} else if (key == "filename"sv) {
_itemFilename = value;
_itemIsFile = true;
}
}
}
_temp = _temp.substring(_temp.indexOf(';') + 2);
while (_temp.indexOf(';') > 0) {
std::string name = _temp.substring(0, _temp.indexOf('='));
std::string nameVal = _temp.substring(_temp.indexOf('=') + 2, _temp.indexOf(';') - 1);
if (name == "name") {
_itemName = nameVal;
} else if (name == "filename") {
_itemFilename = nameVal;
_itemIsFile = true;
}
_temp = _temp.substring(_temp.indexOf(';') + 2);
}
std::string name = _temp.substring(0, _temp.indexOf('='));
std::string nameVal = _temp.substring(_temp.indexOf('=') + 2, _temp.length() - 1);
if (name == "name") {
_itemName = nameVal;
} else if (name == "filename") {
_itemFilename = nameVal;
_itemIsFile = true;
}
}
_temp = std::string();
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/external/AsyncWebServer/WebResponses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <freertos/FreeRTOS.h>

#include "cbuf.h"
#include "external/AsyncWebServer/ESPAsyncWebServer.h"
#include "external/AsyncWebServer/WebResponseImpl.h"
Expand Down
2 changes: 2 additions & 0 deletions src/external/AsyncWebServer/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <freertos/FreeRTOS.h>

#include "external/AsyncWebServer/ESPAsyncWebServer.h"
#include "external/AsyncWebServer/WebHandlerImpl.h"

Expand Down

0 comments on commit cd0bcaf

Please sign in to comment.