rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
wifi_req.c File Reference

The page server's request headers. See wifi_req.h. More...

#include "wifi_req.h"
#include <stdint.h>
#include <string.h>
#include "esp_log.h"
#include "lwip/sockets.h"
#include "sdkconfig.h"

Functions

const char * wifi_req_hdr (httpd_req_t *r, const char *key, char *out, size_t cap)
 Header key of r into out.
static void req_self (httpd_req_t *r, const char *name, wa_self_t *me)
 The panel as r may name it. The server's socket is IPv6 with IPv4 mapped into it when lwIP has IPv6 (CONFIG_LWIP_IPV6); a connection over IPv6 itself has no address a Host may name.
bool wifi_req_guard (httpd_req_t *r, wa_req_kind_t kind, const char *name, wifi_req_bufs_t *bufs, esp_err_t *e)
 wa_guard() over r: the Host, the body's size, a write's Origin or Referer and the upload's header.

Variables

static const char * TAG = "wifi"
 The log tag, the component's.

Detailed Description

The page server's request headers. See wifi_req.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ req_self()

void req_self ( httpd_req_t * r,
const char * name,
wa_self_t * me )
static

The panel as r may name it. The server's socket is IPv6 with IPv4 mapped into it when lwIP has IPv6 (CONFIG_LWIP_IPV6); a connection over IPv6 itself has no address a Host may name.

Parameters
rthe request
namethe panel's name
metakes the panel

◆ wifi_req_guard()

bool wifi_req_guard ( httpd_req_t * r,
wa_req_kind_t kind,
const char * name,
wifi_req_bufs_t * bufs,
esp_err_t * e )

wa_guard() over r: the Host, the body's size, a write's Origin or Referer and the upload's header.

The panel's address is the IPv4 address the connection came in on: the access point's in AP, the station's in JOIN. A refusal is answered here, with no body and the connection closed, so a body not read is never read: httpd_req_delete() would read one to its end, a receive timeout at a time.

Parameters
rthe request
kindwhat it is
namethe panel's name, "rcbench-1A2B"
bufsthe header buffers
etakes the handler's return on a refusal
Returns
true when the request may be answered

◆ wifi_req_hdr()

const char * wifi_req_hdr ( httpd_req_t * r,
const char * key,
char * out,
size_t cap )

Header key of r into out.

Parameters
rthe request
keythe header's name
outtakes the value
capbytes of out
Returns
out; out holding "" for a value of cap bytes or more, which matches nothing; NULL for a header not sent or empty