DeterministicESPAsyncWebServer v6.28.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
ota_service.h File Reference

Optional authenticated OTA firmware update (DETWS_ENABLE_OTA). More...

#include "ServerConfig.h"

Go to the source code of this file.

Functions

void detws_ota_begin (DetWebServer &server, const char *path, const char *user, const char *pass)
 Register an authenticated streaming OTA endpoint.
 

Detailed Description

Optional authenticated OTA firmware update (DETWS_ENABLE_OTA).

Registers a POST endpoint that streams a firmware image straight into the ESP32 Update API via the parser's streaming-body hook (http_parser_set_stream_hooks), so the image never has to fit in RAM. On a successful flash the device responds and reboots into the new firmware. Compiled to a no-op stub when DETWS_ENABLE_OTA is 0 or off-Arduino.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file ota_service.h.

Function Documentation

◆ detws_ota_begin()

void detws_ota_begin ( DetWebServer server,
const char *  path,
const char *  user,
const char *  pass 
)

Register an authenticated streaming OTA endpoint.

Call after begin(). A POST @p path carrying a raw firmware image and valid HTTP Basic credentials is streamed into Update; on success the device replies 200 and reboots. Unauthorized or failed uploads get 401 / 400.

Parameters
serverThe running server (the route + stream hooks are installed on it).
pathURL to accept the upload on (e.g. "/update"). Persistent string.
userRequired HTTP Basic username.
passRequired HTTP Basic password.
curl -u admin:s3cret --data-binary @firmware.bin http://<ip>/update

Definition at line 134 of file ota_service.cpp.