17#ifndef MULTIPART_PARSER_HPP
18#define MULTIPART_PARSER_HPP
22#include <unordered_map>
Defines the HttpRequest class for handling HTTP requests: headers, method, path, query string,...
General-purpose TCP socket abstraction with optional TLS support for both client and server use.
Forward declaration for potential routing needs.
Represents an HTTP response object.
Parses and processes multipart/form-data uploads over HTTP.
int appendFileToSD(const char *filename, const char *data, size_t size)
Append file data to storage (e.g., SD card).
Tcp * tcp
The client TCP connection.
void sendHttpResponse(int statusCode, const std::string &message)
Send a simple HTTP response to the client.
bool processFileData(const std::string &fileData)
Append a chunk of file data to the output file.
void setBoundaryFromContentType(const std::string &contentType)
sets the boundary from the Content-Type header.
MultipartParser()
Construct a new Multipart Parser object.
bool handleFinalBoundary(std::string &fileData)
Detect and handle the final multipart boundary.
int findDataStart(std::string ¤tData)
Find the start of the file content in a chunk (after headers).
bool handleChunk(std::string &chunkData)
Handle an incoming chunk of multipart data.
bool handleMultipart(HttpRequest &req, HttpResponse &res)
Begin processing the multipart upload from the socket.
int file_exists(const std::string &filename)
Check if a file already exists in storage.
static State currentState
bool extractFilename(const std::string &contentDisposition)
Extract the filename from a Content-Disposition header.
General-purpose TCP socket wrapper with optional TLS support via mbedTLS (altcp).