|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser. More...
Go to the source code of this file.
Functions | |
| void | http_reset (uint8_t slot_id) |
| Reset the HTTP parser for a connection slot. | |
| void | http_conn_open (uint8_t slot_id) |
| Initialize a slot for a freshly-accepted HTTP connection. | |
| void | http_parse (uint8_t slot_id) |
| Drain the transport ring buffer and advance the HTTP parser. | |
| void | http_proto_set_poll (void(*fn)(uint8_t slot)) |
Install the HTTP per-slot poll pump (the routing core's instance-bound on_poll). | |
| const ProtoHandler * | http_proto_handler (void) |
Layer 6 (Presentation) - wires the transport ring buffer to the HTTP parser.
This file is now a thin adapter. The HTTP parsing logic lives in http_parser.cpp. This layer only knows about:
The slot-indexed http_reset() pre-stamps slot_id then delegates to http_parser_reset(). The slot-indexed http_parse() drains all available bytes from the ring buffer through http_parser_feed() and stops as soon as the parser reaches any terminal state.
Definition in file presentation.cpp.
| void http_reset | ( | uint8_t | slot_id | ) |
Reset the HTTP parser for a connection slot.
Delegates to http_parser_reset() for the slot's request struct. Silently ignores out-of-range slot IDs.
| slot_id | Index into conn_pool / http_pool (0 … MAX_CONNS-1). |
Definition at line 40 of file presentation.cpp.
References http_parser_reset(), http_pool, MAX_CONNS, and HttpReq::slot_id.
Referenced by DetWebServer::begin(), http_conn_open(), DetWebServer::http_poll_slot(), DetWebServer::redirect(), DetWebServer::send(), DetWebServer::send_chunked(), DetWebServer::send_empty(), DetWebServer::send_template(), and DetWebServer::stop().
| void http_conn_open | ( | uint8_t | slot_id | ) |
Initialize a slot for a freshly-accepted HTTP connection.
Resets the HTTP parser (like http_reset()) and, when keep-alive is enabled, zeroes the slot's persistent request counter. The session layer calls this on EvtType::EVT_CONNECT; http_reset() is used for the lighter inter-request reset that must not clear the counter. With keep-alive off this is identical to http_reset().
| slot_id | Index into conn_pool / http_pool (0 … MAX_CONNS-1). |
Definition at line 65 of file presentation.cpp.
References http_reset(), and MAX_CONNS.
| void http_parse | ( | uint8_t | slot_id | ) |
Drain the transport ring buffer and advance the HTTP parser.
Reads all available bytes from the slot's transport ring buffer and feeds each byte to http_parser_feed(). Stops early if the parser reaches a terminal state (ParseState::PARSE_COMPLETE, ParseState::PARSE_ERROR, ParseState::PARSE_ENTITY_TOO_LARGE, ParseState::PARSE_URI_TOO_LONG).
Silently ignores out-of-range slot IDs.
| slot_id | Connection slot to parse. |
Definition at line 76 of file presentation.cpp.
References http_parser_feed(), http_pool, MAX_CONNS, PARSE_COMPLETE, PARSE_ENTITY_TOO_LARGE, PARSE_ERROR, HttpReq::parse_state, PARSE_URI_TOO_LONG, and ws_find().
Referenced by DetWebServer::http_poll_slot().
| void http_proto_set_poll | ( | void(*)(uint8_t slot) | fn | ) |
Install the HTTP per-slot poll pump (the routing core's instance-bound on_poll).
HTTP is the one protocol whose poll needs the DetWebServer instance (routing), so the application layer installs its pump here at begin() - the TX-seam (resp_sink) counterpart for the poll direction. With it set, HTTP plugs into the uniform ProtoHandler::on_poll seam exactly like every other protocol, so the L5/worker dispatch loop has no HTTP special case.
Definition at line 244 of file presentation.cpp.
Referenced by DetWebServer::service_once().
| const ProtoHandler * http_proto_handler | ( | void | ) |
Definition at line 251 of file presentation.cpp.
Referenced by proto_register_builtins().