![]() |
Fun API Documentation 0.42.1
The programming language that makes you have fun!
|
libcurl helpers and buffers used by HTTP-related VM opcodes. More...
#include <curl/curl.h>Go to the source code of this file.
Data Structures | |
| struct | FunCurlBuf |
| Simple growable buffer for libcurl write callbacks. More... | |
Functions | |
| static size_t | fun_curl_write_cb (void *ptr, size_t sz, size_t nm, void *ud) |
| libcurl write callback that appends data to a FunCurlBuf. | |
| static size_t | fun_curl_file_write_cb (void *ptr, size_t sz, size_t nm, void *ud) |
| libcurl write callback that writes directly to a FILE*. | |
libcurl helpers and buffers used by HTTP-related VM opcodes.
This module centralizes small, concrete libcurl utilities used by VM opcodes under src/vm/http/*.c (or similar). The opcodes themselves perform VM stack marshalling and call these helpers for I/O glue. Keeping the concrete logic here mirrors other extensions (e.g., PCRE2, SQLite) and allows the opcode code to remain minimal.
Build-time feature flag:
Buffering and ownership model:
Callbacks provided:
Error handling:
Thread-safety:
Definition in file curl.c.
|
static |
libcurl write callback that writes directly to a FILE*.
Suitable for large downloads or when incremental flushing to disk is desired. The FILE* should be opened in binary mode (e.g., "wb").
| ptr | Pointer to incoming data. |
| sz | Size of each element. |
| nm | Number of elements. |
| ud | User data; must be a FILE* opened for writing in binary mode (passed via CURLOPT_WRITEDATA). |
|
static |
libcurl write callback that appends data to a FunCurlBuf.
Reallocates the destination buffer as needed and keeps it NUL-terminated. The buffer must be initialized by the caller with { .d=NULL, .n=0 } prior to first use.
| ptr | Pointer to incoming data block provided by libcurl. |
| sz | Size of each data element (as provided by libcurl). |
| nm | Number of elements in this block (as provided by libcurl). |
| ud | User data; must be a FunCurlBuf* (passed via CURLOPT_WRITEDATA). |