|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
HTTP client wrapper over esp_http_client. More...
#include "plugin_manager/Raii.h"#include "plugin_manager/SlotTable.h"#include "plugin_manager/host_api.h"#include "cdc_log.h"#include "esp_http_client.h"#include "esp_crt_bundle.h"#include "esp_err.h"#include <cstdlib>#include <cstring>#include <memory>#include <string>#include <type_traits>Go to the source code of this file.
Functions | |
| void * | plg_get_active_plugin (void) |
| esp_http_client_handle_t | makeClient (uint8_t method, const char *url, uint32_t timeout_ms) |
| int | host_http_open (uint8_t method, const char *url, uint32_t timeout_ms) |
| Open an HTTP request. | |
| int | host_http_set_header (int handle, const char *key, const char *value) |
| Add a request header before perform(). | |
| int | host_http_set_body (int handle, const uint8_t *body, size_t len) |
| Stage a request body before perform(). | |
| int | host_http_perform (int handle) |
| Send the request and read response headers. | |
| int | host_http_status (int handle) |
| HTTP response status code, or negative on error. | |
| int | host_http_read_chunk (int handle, uint8_t *buf, size_t buf_size, size_t *out_len) |
| Stream one response chunk into buf. | |
| size_t | host_http_content_length (int handle) |
| Response Content-Length, or 0 when unknown / chunked. | |
| int | host_http_close (int handle) |
| Release a request handle. | |
| void | plg_http_on_unload (void *plugin) |
HTTP client wrapper over esp_http_client.
Holds up to 4 simultaneous in-flight requests in a fixed slot table so the WAMR-WASM side can identify them by integer handle. The whole response body is buffered in PSRAM during host_http_perform (via the event handler, or a manual drain on the auth-error path); host_http_read_chunk then hands it out sequentially from that buffer, so reads are chunked but not truly streamed. The body buffer is capped at MAX_HTTP_BODY_BYTES and silently truncated past it; the read cursor is one-way (a body cannot be re-read); Content-Type is not exposed. Connections are kept alive in a small per-origin pool and reused across requests; a slot borrows a pooled connection (returned to the pool on close) or, when the pool is full, owns a transient client freed on close.
Definition in file host_api_http.cpp.
| esp_http_client_handle_t makeClient | ( | uint8_t | method, |
| const char * | url, | ||
| uint32_t | timeout_ms ) |
| void * plg_get_active_plugin | ( | void | ) |
Definition at line 24 of file plugin_log_bridge.cpp.
Referenced by host_http_open().
| void plg_http_on_unload | ( | void * | plugin | ) |
Definition at line 325 of file host_api_http.cpp.
References LOG_W, and cdc::plugin_manager::SlotTable< T, N >::slots.