|
cwist
Modern C web framework with libttak runtime
|
RFC 7578 multipart/form-data parser. More...
#include <stddef.h>

Go to the source code of this file.
Classes | |
| struct | cwist_multipart_field |
| struct | cwist_multipart_result |
Typedefs | |
| typedef struct cwist_multipart_field | cwist_multipart_field |
| typedef struct cwist_multipart_result | cwist_multipart_result |
Functions | |
| cwist_multipart_result * | cwist_multipart_parse (const char *body, size_t body_len, const char *boundary) |
| Parse a multipart/form-data body. | |
| void | cwist_multipart_result_destroy (cwist_multipart_result *result) |
| Free all memory associated with a multipart parse result. | |
| char * | cwist_multipart_extract_boundary (const char *content_type) |
| Extract the boundary string from a Content-Type header value. | |
RFC 7578 multipart/form-data parser.
Definition in file multipart.h.
Extract the boundary string from a Content-Type header value.
| content_type | Content-Type header value, e.g. "multipart/form-data; boundary=----WebKitFormBoundary..." |
Extract the boundary string from a Content-Type header value.
Scans semicolon-separated parameters of content_type, skipping optional whitespace, and accepts both quoted and unquoted boundary values.
| content_type | Content-Type header value, e.g. from the request; may be NULL. |
Definition at line 363 of file multipart.c.
References cap, and cwist_alloc().
| cwist_multipart_result * cwist_multipart_parse | ( | const char * | body, |
| size_t | body_len, | ||
| const char * | boundary | ||
| ) |
Parse a multipart/form-data body.
| body | Raw body buffer (may contain binary data). |
| body_len | Length of body in bytes. |
| boundary | Boundary string (without leading hyphens). |
Parse a multipart/form-data body.
Runs the multipart-parser-c state machine over body with boundary (the boundary without leading dashes). On malformed or truncated input the parser stops early and NULL is returned, with all intermediate state freed.
| body | Raw body bytes; must not be NULL. |
| body_len | Length of body in bytes. |
| boundary | MIME boundary string, without the leading "--". |
Definition at line 269 of file multipart.c.
References cap, cwist_alloc(), cwist_free(), cwist_multipart_result_destroy(), CWIST_SCRATCH_DEFER, and cwist_multipart_result::fields.
| void cwist_multipart_result_destroy | ( | cwist_multipart_result * | result | ) |
Free all memory associated with a multipart parse result.
| result | Result to destroy. NULL is ignored. |
Free all memory associated with a multipart parse result.
Frees every field's name, filename, content_type, and data, then the field nodes and the result itself. Safe to call with NULL.
| result | Result returned by cwist_multipart_parse, or NULL. |
Definition at line 336 of file multipart.c.
References cap, cwist_free(), cwist_multipart_result::fields, and cwist_multipart_field::next.
Referenced by cwist_multipart_parse().