|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Which requests the Wi-Fi page answers. See wa_guard.h. More...
#include "wa_guard.h"#include "wa_session.h"#include <stdio.h>#include <string.h>#include <strings.h>Macros | |
| #define | HOST_MAX (WA_NAME_MAX + 7u) |
| Bytes of the longest name the guard compares with, "rcbench-1A2B.local.", and its terminator. | |
Functions | |
| static bool | same (const char *s, size_t n, const char *want) |
Whether n bytes at s are want, letters compared without regard to case. | |
| static bool | host_name_ok (const char *s, size_t n, const wa_self_t *self) |
Whether n bytes at s, a host without its port, name the panel. | |
| static bool | host_part_ok (const char *s, size_t n, const wa_self_t *self) |
Whether n bytes at s, a host with an optional port, name the panel. | |
| bool | wa_host_ok (const char *host, const wa_self_t *self) |
Whether host, a Host header's value, names the panel. | |
| static bool | url_ok (const char *url, bool path, const wa_self_t *self) |
Whether url is "http://" and an allowed host, followed by nothing or, with path, by "/", "?" or "#". | |
| bool | wa_origin_ok (const char *origin, const char *referer, const wa_self_t *self) |
| Whether a write comes from the panel's own page. | |
| wa_guard_t | wa_guard (wa_req_kind_t kind, const wa_req_t *req, const wa_self_t *self) |
| The guard: Host first, then the body, then a write's Origin and the upload's header. | |
| const char * | wa_guard_status (wa_guard_t g) |
| The HTTP status line of a refusal, "421 Misdirected Request" and the like. | |
Which requests the Wi-Fi page answers. See wa_guard.h.
SPDX-License-Identifier: MIT
|
static |
Whether n bytes at s, a host without its port, name the panel.
| s | the host |
| n | its bytes |
| self | the panel |
|
static |
Whether n bytes at s, a host with an optional port, name the panel.
| s | the host part of a Host, an Origin or a Referer |
| n | its bytes |
| self | the panel |
|
static |
Whether n bytes at s are want, letters compared without regard to case.
| s | the bytes |
| n | how many |
| want | the text, NUL-terminated |
|
static |
Whether url is "http://" and an allowed host, followed by nothing or, with path, by "/", "?" or "#".
| url | an Origin or a Referer |
| path | a Referer: a path may follow |
| self | the panel |
| wa_guard_t wa_guard | ( | wa_req_kind_t | kind, |
| const wa_req_t * | req, | ||
| const wa_self_t * | self ) |
The guard: Host first, then the body, then a write's Origin and the upload's header.
| kind | what the request is |
| req | its headers |
| self | the panel |
| const char * wa_guard_status | ( | wa_guard_t | g | ) |
The HTTP status line of a refusal, "421 Misdirected Request" and the like.
| g | the answer; WA_GUARD_OK gives "200 OK" |
| bool wa_host_ok | ( | const char * | host, |
| const wa_self_t * | self ) |
Whether host, a Host header's value, names the panel.
| host | the value; NULL refuses |
| self | the panel |
| bool wa_origin_ok | ( | const char * | origin, |
| const char * | referer, | ||
| const wa_self_t * | self ) |
Whether a write comes from the panel's own page.
| origin | the Origin header, or NULL |
| referer | the Referer header, read only when origin is NULL |
| self | the panel |