14#ifndef PROTOCORE_HTTP_H
15#define PROTOCORE_HTTP_H
98#if PROTOCORE_ENABLE_EDGE_CACHE
99 embed_bool (*edge_poll)(uint8_t
slot);
104#if PROTOCORE_ENABLE_EDGE_CACHE
147static const HttpNs Http __attribute__((unused)) = {
void protocore_http_status_text(const uint8_t *work)
void protocore_http_path_matches(const uint8_t *work)
void protocore_http_set_not_found(uint8_t *work)
void protocore_http_poll_slot(uint8_t *work)
void protocore_http_allow_append(const uint8_t *work)
HttpMethod
The request methods a route binds to.
@ HTTP_PUT
Idempotent replace.
@ HTTP_DELETE
Idempotent delete.
@ HTTP_GET
Safe, idempotent read.
@ HTTP_OPTIONS
Capability query / CORS preflight.
@ HTTP_POST
Non-idempotent create / action.
@ HTTP_HEAD
Same as GET but no response body.
@ HTTP_PATCH
Partial update.
@ HTTP_METHOD_UNKNOWN
Unrecognized method token, answered 501.
void protocore_http_match_path_params(const uint8_t *work)
void protocore_http_req_is_head(const uint8_t *work)
uint8_t * protocore_http_span(void)
The PROTOCORE_HTTP_BORROW bytes this module's state lives in.
void(* Handler)(uint8_t slot_id, HttpReq *request)
A route's request handler.
void protocore_http_match_and_execute(uint8_t *work)
HttpVars HttpV
The operands and the outcome.
void protocore_http_reset(uint8_t *work)
void protocore_http_set_edge_poll(uint8_t *work)
void protocore_http_parse_method(const uint8_t *work)
void protocore_http_method_name(const uint8_t *work)
RFC 9110 sec 10.2.1 Allow: the comma-separated list an append builds.
char * buf
where the list is built
size_t cap
how much room it has
RFC 9110 sec 9: a method, held either as the enum or as its token.
HttpMethod method
the method a name lookup names
const char * token
a method token, or the one an Allow list appends
void(*const match_path_params)(const uint8_t *work)
void(*const allow_append)(const uint8_t *work)
void(*const parse_method)(const uint8_t *work)
void(*const match_and_execute)(uint8_t *work)
void(*const poll_slot)(uint8_t *work)
void(*const path_matches)(const uint8_t *work)
void(*const req_is_head)(const uint8_t *work)
void(*const set_not_found)(uint8_t *work)
void(*const status_text)(const uint8_t *work)
void(*const set_edge_poll)(uint8_t *work)
void(*const reset)(uint8_t *work)
void(*const method_name)(const uint8_t *work)
RFC 9110 sec 7.1 request target: the route pattern, and the path tested against it.
embed_bool is_wildcard
that route ends in a trailing star
const char * route
the route path a match tests
const char * path
the request path a match tests against
HttpReq * req
the request a param capture writes into
HttpRouteArgs route_args
the target a route is matched against
int code
the status code a lookup names
HttpMethodArgs method_args
a method, as an enum or as a token
HttpAllowArgs allow
the Allow list an append builds
uint8_t slot
the connection every call names
Handler cb
the handler a request runs when no route matched