Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
MultipartParser.cpp File Reference

Implementation of multipart/form-data parsing and file upload handling. More...

#include "framework_config.h"
#include "DebugTrace.h"
#include "http/MultipartParser.h"
#include <lwip/sockets.h>
#include <iostream>
#include <cstring>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <cctype>
#include <FreeRTOS.h>
#include <task.h>
#include "framework/AppContext.h"
#include "storage/StorageManager.h"
+ Include dependency graph for MultipartParser.cpp:

Go to the source code of this file.

Detailed Description

Author
Ian Archbell

Part of the PicoFramework HTTP server. This module processes multipart/form-data uploads, detects boundaries, parses headers, extracts filenames, and writes file data to storage. It also handles sending appropriate HTTP responses based on the success or failure of the upload process.

Extracts the boundary from the Content-Type header Manages multipart state using a basic state machine (SEARCHING_FOR_BOUNDARY, FOUND_BOUNDARY, etc.) Used a streaming recv() loop Bufferes data and handles chunk boundaries Writes file data incrementally (appends to file to cope with large file sizes) Rejects uploads with duplicate filenames Only supports one file per request (for simplicity)

Version
0.1
Date
2025-03-26
License:\n MIT License

Definition in file MultipartParser.cpp.