|
Pharos 0.7.23
Modern Web Framework & Web App Hosting Service.
|
Pharos-owned multipart form-data parsing for in-process dynamic handling. More...
#include <stddef.h>Go to the source code of this file.
Functions | |
Boundary extraction | |
| char * | native_dynamic_multipart_boundary (const char *content_type) |
| Extracts the MIME boundary string from a Content-Type header. | |
Part lookup | |
| int | native_dynamic_multipart_find_part (const unsigned char *body, size_t body_len, const char *content_type, const char *field_name, char **out_text, char **out_filename, const unsigned char **out_content_start, size_t *out_content_len) |
| Finds a named part in a multipart request body. | |
Filename extraction | |
| char * | native_dynamic_multipart_filename (const unsigned char *body, size_t body_len, const char *content_type, const char *field_name) |
| Extracts the uploaded filename for a named multipart file part. | |
Text extraction | |
| char * | native_dynamic_multipart_extract_text (const unsigned char *body, size_t body_len, const char *content_type, const char *field_name) |
| Extracts a text value from a multipart form field. | |
File extraction | |
| int | native_dynamic_multipart_extract_file (const unsigned char *body, size_t body_len, const char *content_type, const char *field_name, const char *output_path) |
| Extracts file content from a multipart file part and writes it to disk. | |
Pharos-owned multipart form-data parsing for in-process dynamic handling.
Provides boundary extraction, part lookup, filename extraction, and file-part extraction so that the dynamic runtime can process multipart uploads without delegating to a child process or relying on app-owned shell logic.
Definition in file native_dynamic_multipart.h.
| char * native_dynamic_multipart_boundary | ( | const char * | content_type | ) |
Extracts the MIME boundary string from a Content-Type header.
Extracts the MIME boundary from a Content-Type header value.
| content_type | The full Content-Type header value. |
-- ), or NULL when the boundary cannot be determined. Caller must free.Extracts the MIME boundary string from a Content-Type header.
Handles both quoted and unquoted boundary parameters.
| content_type | The full Content-Type header value. |
-- ), or NULL when the boundary cannot be determined. Definition at line 82 of file native_dynamic_multipart.c.
References multipart_dup_range().
Referenced by native_dynamic_multipart_find_part().
| int native_dynamic_multipart_extract_file | ( | const unsigned char * | body, |
| size_t | body_len, | ||
| const char * | content_type, | ||
| const char * | field_name, | ||
| const char * | output_path ) |
Extracts file content from a multipart file part and writes it to disk.
| body | Raw multipart body bytes. |
| body_len | Byte length of body. |
| content_type | The full Content-Type header. |
| field_name | The form field name of the file input. |
| output_path | Destination file path on disk. |
Definition at line 306 of file native_dynamic_multipart.c.
References native_dynamic_multipart_find_part().
Referenced by handle_dynamic_multipart_extract_file_command().
| char * native_dynamic_multipart_extract_text | ( | const unsigned char * | body, |
| size_t | body_len, | ||
| const char * | content_type, | ||
| const char * | field_name ) |
Extracts a text value from a multipart form field.
| body | Raw multipart body bytes. |
| body_len | Byte length of body. |
| content_type | The full Content-Type header. |
| field_name | The form field name to extract. |
Definition at line 295 of file native_dynamic_multipart.c.
References native_dynamic_multipart_find_part().
Referenced by handle_dynamic_multipart_extract_text_command(), request_form_value_dup_logic_local(), and request_form_value_dup_runtime().
| char * native_dynamic_multipart_filename | ( | const unsigned char * | body, |
| size_t | body_len, | ||
| const char * | content_type, | ||
| const char * | field_name ) |
Extracts the uploaded filename for a named multipart file part.
| body | Raw multipart body bytes. |
| body_len | Byte length of body. |
| content_type | The full Content-Type header. |
| field_name | The form field name of the file input. |
Definition at line 284 of file native_dynamic_multipart.c.
References native_dynamic_multipart_find_part().
Referenced by handle_dynamic_multipart_filename_command().
| int native_dynamic_multipart_find_part | ( | const unsigned char * | body, |
| size_t | body_len, | ||
| const char * | content_type, | ||
| const char * | field_name, | ||
| char ** | out_text, | ||
| char ** | out_filename, | ||
| const unsigned char ** | out_content_start, | ||
| size_t * | out_content_len ) |
Finds a named part in a multipart request body.
Searches body for a part whose Content-Disposition name matches field_name. When found, optionally returns the text content, the uploaded filename, and/or the raw content range within body.
| body | Raw multipart body bytes. |
| body_len | Byte length of body. |
| content_type | The full Content-Type header (must contain the boundary). |
| field_name | The form field name to locate. |
| out_text | Receives a NUL-terminated copy of the part content (may be NULL to skip). |
| out_filename | Receives the uploaded filename (may be NULL to skip). |
| out_content_start | Receives a pointer into body at the content start (may be NULL to skip). |
| out_content_len | Receives the content byte length (may be NULL to skip). |
Definition at line 140 of file native_dynamic_multipart.c.
References multipart_dup_range(), multipart_header_param_dup(), multipart_memmem(), and native_dynamic_multipart_boundary().
Referenced by native_dynamic_multipart_extract_file(), native_dynamic_multipart_extract_text(), native_dynamic_multipart_filename(), and store_uploaded_media().