|
libfetch 0.0.0
A lightweight asynchronous HTTP/1.1 client library implementing a subset of the WHATWG Fetch API.
|
Request or response body. More...
#include <fetch.h>
Data Fields | ||
| fetch_body_type_t | type | |
| union { | ||
| struct { | ||
| const void * data | ||
| size_t size | ||
| } memory | ||
| struct { | ||
| FETCH_FILE_HANDLE handle | ||
| size_t size | ||
| size_t offset | ||
| bool close_on_free | ||
| fetch_file_continue_cb continue_cb | ||
| void * userdata | ||
| } file | ||
| } | data | |
| const char * | content_type | |
Request or response body.
Contains the data payload along with its type and content type. Supports both in-memory data and file streaming using a tagged union.
For file streaming, the library supports:
| bool fetch_body_t::close_on_free |
Whether to close handle when body is freed
| const char* fetch_body_t::content_type |
MIME content type
| fetch_file_continue_cb fetch_body_t::continue_cb |
NULL = regular file, non-NULL = streaming
| const void* fetch_body_t::data |
Pointer to body data
| union { ... } fetch_body_t::data |
| struct { ... } fetch_body_t::file |
| FETCH_FILE_HANDLE fetch_body_t::handle |
File handle for streaming
| struct { ... } fetch_body_t::memory |
| size_t fetch_body_t::offset |
Current read offset in file
| size_t fetch_body_t::size |
Size of body in bytes
File size in bytes (0 if unknown)
| fetch_body_type_t fetch_body_t::type |
Type of body content (union tag)
| void* fetch_body_t::userdata |
User data for callback