14#if PC_ENABLE_HTTP_DELIVERY && defined(ARDUINO)
23struct DeliveryRoutesCtx
26 const char *
const *paths =
nullptr;
28 const char *version =
nullptr;
30static DeliveryRoutesCtx s_delr;
32static void sw_script_handler(uint8_t slot_id,
HttpReq *req)
41static void sw_manifest_handler(uint8_t slot_id,
HttpReq *req)
51 if (pc_delivery_sw_manifest(s_delr.paths, s_delr.n, s_delr.version, buf,
sizeof(buf)) == 0)
53 s_delr.srv->send(slot_id, 500, PC_MIME_JSON,
"{\"error\":\"manifest too large\"}");
56 s_delr.srv->send(slot_id, 200, PC_MIME_JSON, buf);
59bool pc_delivery_serve_sw(
PC &srv,
const char *
const *paths,
size_t n,
const char *version)
68 s_delr.version = version;
Single-port HTTP server with deterministic, zero-allocation execution.
void on(const char *path, HttpMethod method, Handler callback)
Register a route handler.
HTTP delivery optimizations: stale-while-revalidate, Range/206 delta fetch, SW precache (PC_ENABLE_HT...
Shared HTTP Content-Type ("MIME") string constants (one source of truth).
Layer 7 (Application) - public HTTP routing API.
@ HTTP_GET
Safe, idempotent read.
#define PC_DELIVERY_MANIFEST_BUF
Buffer the precache manifest JSON is built into (PC_DELIVERY_MANIFEST_BUF).
#define PC_DELIVERY_PRECACHE_MAX
Most asset paths a service-worker precache manifest may list (PC_DELIVERY_PRECACHE_MAX).
Fully-parsed HTTP/1.1 request.
const char PC_SERVICE_WORKER[]
Service worker: precaches the app shell from the versioned manifest and serves it stale-while-revalid...
Layer 7 (Application) - embedded web assets generated from web_assets/input/.