From 33ae3777a377cf564eec2fc9acf1f21088201221 Mon Sep 17 00:00:00 2001 From: Catalin Patulea Date: Sun, 18 Jan 2026 08:41:24 -0500 Subject: [PATCH] toradio, fromradio OPTIONS handler: fix sending proper HTTP response. (#9322) Before this (missing response): $ curl -v -X OPTIONS http://meshtastic.local/api/v1/fromradio * Host meshtastic.local:80 was resolved. * IPv6: (none) * IPv4: 192.168.0.19 * Trying 192.168.0.19:80... * Connected to meshtastic.local (192.168.0.19) port 80 * using HTTP/1.x > OPTIONS /api/v1/fromradio HTTP/1.1 > Host: meshtastic.local > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off * Empty reply from server * shutting down connection #0 curl: (52) Empty reply from server After this (proper HTTP 204 response): $ curl -v -X OPTIONS http://meshtastic.local/api/v1/fromradio * Host meshtastic.local:80 was resolved. * IPv6: (none) * IPv4: 192.168.0.19 * Trying 192.168.0.19:80... * Connected to meshtastic.local (192.168.0.19) port 80 * using HTTP/1.x > OPTIONS /api/v1/fromradio HTTP/1.1 > Host: meshtastic.local > User-Agent: curl/8.14.1 > Accept: */* > * Request completely sent off < HTTP/1.1 204 OK < Content-Type: application/x-protobuf < Access-Control-Allow-Origin: * < Access-Control-Allow-Methods: GET < X-Protobuf-Schema: https://raw.githubusercontent.com/meshtastic/protobufs/master/meshtastic/mesh.proto < * Connection #0 to host meshtastic.local left intact This is related to https://github.com/meshtastic/firmware/issues/5385. Co-authored-by: Ben Meadors --- src/mesh/http/ContentHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index 7b7ebb595..ea8d6af8e 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -173,7 +173,7 @@ void handleAPIv1FromRadio(HTTPRequest *req, HTTPResponse *res) if (req->getMethod() == "OPTIONS") { res->setStatusCode(204); // Success with no content - // res->print(""); @todo remove + res->print(""); return; } @@ -223,7 +223,7 @@ void handleAPIv1ToRadio(HTTPRequest *req, HTTPResponse *res) if (req->getMethod() == "OPTIONS") { res->setStatusCode(204); // Success with no content - // res->print(""); @todo remove + res->print(""); return; }