This commit is contained in:
J. Nick Koston 2025-06-29 11:07:48 -05:00
parent f57e26c54e
commit 15a995b2e7
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,6 @@ static const char *const TAG = "multipart_parser";
static constexpr size_t CRLF_LENGTH = 2;
static constexpr size_t MIN_BOUNDARY_BUFFER = 4; // Extra bytes to keep for split boundary detection
static constexpr const char *CRLF_STR = "\r\n";
static constexpr const char *DOUBLE_DASH = "--";
bool MultipartParser::parse(const uint8_t *data, size_t len) {
// Append new data to buffer

View File

@ -12,6 +12,8 @@ namespace web_server_idf {
// Multipart form data parser for ESP-IDF
class MultipartParser {
public:
static constexpr const char *MULTIPART_BOUNDARY_PREFIX = "--";
enum State : uint8_t { BOUNDARY_SEARCH, HEADERS, CONTENT, DONE, ERROR };
struct Part {
@ -23,7 +25,7 @@ class MultipartParser {
};
explicit MultipartParser(const std::string &boundary)
: boundary_("--" + boundary),
: boundary_(MULTIPART_BOUNDARY_PREFIX + boundary),
state_(BOUNDARY_SEARCH),
content_start_(0),
content_length_(0),