From d2c19ef13d73b92b94a29e2b226d76347d36374e Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 5 Jun 2023 18:15:58 +0200 Subject: core: add X-Sequence header support Add non-standard HTTP header "X-Sequence" to the header section of requests (og_send_request) sent to a connected client. Define a starting sequence number when creating a new instance of struct og_client inside og_server_accept_cb. This sequence number is incremented by one for each outgoing request from ogServer. This sequence number is checked when receiving a response from a connected client, if they do not match the connection is dropped. Use sequence 0 for out-of-band commands (reboot, poweroff, stop). Any client response with header "X-Sequence: 0" bypasses sequence check. --- src/rest.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rest.h') diff --git a/src/rest.h b/src/rest.h index df6b225..d146868 100644 --- a/src/rest.h +++ b/src/rest.h @@ -68,6 +68,7 @@ struct og_client { enum og_cmd_result last_cmd_result; bool autorun; uint32_t speed; + uint32_t seq; const char *shell_output; }; -- cgit v1.2.3-18-g5258