Multipart/form-data request body parsing implementation.
- Copyright
- MIT License
Parse a multipart/form-data request body and invoke a handler for each part.
Parse a multipart/form-data request body.
Extracts the boundary string from the Content-Type header, then iterates through the request body looking for boundary-delimited parts. For each part, the function parses the Content-Disposition header (extracting name and optional filename), the optional Content-Type header, and the part body. A csilk_multipart_part_t struct is populated and passed to the caller-supplied handler callback.
- Parameters
-
| c | The request context containing the parsed body. |
| handler | Callback invoked once per parsed part. Receives a pointer to a csilk_multipart_part_t describing the part. Must not be NULL. |
- Note
- The part data pointers reference memory within the request body buffer directly — they are NOT copies. The handler must not modify or store the pointers beyond its invocation.
- Warning
- Part body data is NOT null-terminated. Use part.data_len to determine the bounds.
-
Maximum part name length is 127 bytes, maximum filename length is 255 bytes, and maximum part headers per section is 32. Parts exceeding these limits will be silently truncated.