|
DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
|
In-place multipart/form-data parser (RFC 7578). More...
Go to the source code of this file.
Classes | |
| struct | MultipartPart |
| One parsed part from a multipart body. More... | |
| struct | Multipart |
| Container for all parsed parts of a multipart body. More... | |
Functions | |
| bool | multipart_parse (HttpReq *req, Multipart *mp) |
Parse the body of req as multipart/form-data. | |
| const char * | multipart_get_field (const Multipart *mp, const char *field) |
| Look up a field value across all parsed parts by name. | |
In-place multipart/form-data parser (RFC 7578).
Parses the body already stored in HttpReq::body[]. The parser modifies the body buffer in-place by inserting null terminators, so part->data pointers are valid only while the HttpReq lives (before http_reset()).
Limitations
MAX_MULTIPART_PARTS (default 4).BODY_BUF_SIZE bytes.name and filename are extracted from Content-Disposition; other parameters are ignored.MAX_BOUNDARY_LEN bytes (RFC 2046 cap: 70).Definition in file multipart.h.
Parse the body of req as multipart/form-data.
Reads the boundary from the Content-Type header, then scans req->body in-place, null-terminating each part's headers and data.
| req | Fully-parsed HTTP request (must be in PARSE_COMPLETE state). |
| mp | Output structure; filled on success. |
Definition at line 39 of file multipart.cpp.
References HttpReq::body, MultipartPart::data, MultipartPart::data_len, MultipartPart::filename, http_get_header(), MAX_BOUNDARY_LEN, MAX_MULTIPART_PARTS, MultipartPart::name, Multipart::part_count, Multipart::parts, and MultipartPart::type.
| const char * multipart_get_field | ( | const Multipart * | mp, |
| const char * | field | ||
| ) |
Look up a field value across all parsed parts by name.
Returns the data pointer of the first part whose name matches field. Useful for simple form submissions where each field has a unique name.
| mp | Parsed multipart result. |
| field | Form field name to search for. |
Definition at line 152 of file multipart.cpp.
References MultipartPart::data, MultipartPart::name, Multipart::part_count, and Multipart::parts.