picow-http 1.1.0-2-ga16b87a
HTTP server for the Raspberry Pi PicoW
http.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Geoff Simmons <geoff@simmons.de>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 * See LICENSE
6 */
7
281#ifndef _PICOW_HTTP_H
282#define _PICOW_HTTP_H
283
284#include <string.h>
285
286#include "lwip/ip_addr.h"
287#include "lwip/prot/iana.h"
288#include "lwip/err.h"
289
290#include "assertion.h"
291#include "log.h"
292#include "ntp.h"
293#include "version.h"
294
295/*
296 * Declarations required *before* including http_priv.h.
297 */
298
314#ifndef HTTP_REQ_MAX_HDRS
315#define HTTP_REQ_MAX_HDRS (16)
316#endif
317
341struct http;
342
363typedef err_t (*hndlr_f)(struct http *http, void *priv);
364
385};
386
398#define HTTP_METHODS_GET_HEAD \
399 ((1U << HTTP_METHOD_GET) | (1U << HTTP_METHOD_HEAD))
400
416typedef void priv_fini_f(void *p);
417
418#include "http_priv.h"
419
445static inline void
446http_cx_set_priv(struct http *http, void *priv, priv_fini_f *fini)
447{
448 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
449 http->cx_priv.priv = priv;
450 http->cx_priv.fini = fini;
451}
452
470static inline void *
472{
473 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
474 return http->cx_priv.priv;
475}
476
578};
579
594#ifndef HTTP_DEFAULT_IDLE_TMO_S
595#define HTTP_DEFAULT_IDLE_TMO_S (5)
596#endif
597
610#ifndef HTTP_DEFAULT_SEND_TMO_S
611#define HTTP_DEFAULT_SEND_TMO_S (5)
612#endif
613
627#ifndef HTTP_DEFAULT_LISTEN_BACKLOG
628#define HTTP_DEFAULT_LISTEN_BACKLOG (10)
629#endif
630
656#define STRLEN_LTRL(s) (sizeof(s) - 1)
657
683struct req;
684
718struct resp;
719
772 const ip_addr_t *ipaddr;
773 struct srv_data *srv_data;
782 unsigned idle_tmo_s;
784 unsigned send_tmo_s;
786 uint16_t port;
790 enum lwip_ip_addr_type ip_type;
792 bool tls;
793};
794
818struct server;
819
855err_t http_cfg(const char *name, struct server_cfg *cfg);
856
894static inline struct server_cfg
896{
897 err_t err;
898 struct server_cfg cfg;
899
900 err = http_cfg("default", &cfg);
901 PICOW_HTTP_ASSERT(err == ERR_OK);
902 return cfg;
903}
904
948err_t http_srv_init(struct server **server, struct server_cfg *cfg);
949
991
1045ip_addr_t * http_srv_ip(struct server *server);
1046
1080uint16_t http_srv_port(struct server *server);
1081
1121void http_srv_set_priv(struct server *server, void *priv, priv_fini_f *fini);
1122
1162static inline ip_addr_t *
1164{
1165 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1166 AN(http->pcb);
1167 return http_local_ip(http->pcb);
1168}
1169
1184static inline uint16_t
1186{
1187 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1188 AN(http->pcb);
1189 return http_local_port(http->pcb);
1190}
1191
1231static inline ip_addr_t *
1233{
1234 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1235 AN(http->pcb);
1236 return http_remote_ip(http->pcb);
1237}
1238
1252static inline uint16_t
1254{
1255 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1256 AN(http->pcb);
1257 return http_remote_port(http->pcb);
1258}
1259
1296static inline void *
1298{
1299 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1300 CHECK_OBJ_NOTNULL(http->srv_data, SRV_DATA_MAGIC);
1301 return http->srv_data->srv_priv;
1302}
1303
1330static inline struct req *
1332{
1333 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
1334 CHECK_OBJ_NOTNULL(&http->req, REQ_MAGIC);
1335 return &http->req;
1336}
1337
1387const char * http_req_hdr(struct req *req, const char *name, size_t name_len,
1388 size_t *val_len);
1389
1432static inline const char *
1433http_req_hdr_str(struct req *req, const char *name, size_t *val_len)
1434{
1435 return http_req_hdr(req, name, strlen(name), val_len);
1436}
1437
1481#define http_req_hdr_ltrl(req, name, val_len) \
1482 http_req_hdr((req), (name), STRLEN_LTRL(name), (val_len))
1483
1523bool http_req_hdr_eq(struct req *req, const char *name, size_t name_len,
1524 const char *val, size_t val_len);
1525
1565bool http_req_hdr_contains(struct req *req, const char *name, size_t name_len,
1566 const char *substring, size_t substring_len);
1567
1603static inline bool
1604http_req_hdr_eq_str(struct req *req, const char *name, const char *val)
1605{
1606 return http_req_hdr_eq(req, name, strlen(name), val, strlen(val));
1607}
1608
1647static inline bool
1648http_req_hdr_contains_str(struct req *req, const char *name,
1649 const char *substring)
1650{
1651 return http_req_hdr_contains(req, name, strlen(name), substring,
1652 strlen(substring));
1653}
1654
1689#define http_req_hdr_eq_ltrl(req, name, val) \
1690 http_req_hdr_eq((req), (name), STRLEN_LTRL(name), (val), \
1691 STRLEN_LTRL(val))
1692
1730#define http_req_hdr_contains_ltrl(req, name, substring) \
1731 http_req_hdr_contains((req), (name), STRLEN_LTRL(name), (substring), \
1732 STRLEN_LTRL(substring))
1733
1780typedef err_t (*name_val_iter_f)(const char *name, size_t name_len,
1781 const char *val, size_t val_len, void *priv);
1782
1831err_t http_req_hdr_iter(struct req *req, name_val_iter_f iter_cb, void *priv);
1832
1903const uint8_t * http_req_cookie(struct req *req, const char *name,
1904 size_t name_len, size_t *val_len);
1905
1957static inline const uint8_t *
1958http_req_cookie_str(struct req *req, const char *name, size_t *val_len)
1959{
1960 return http_req_cookie(req, name, strlen(name), val_len);
1961}
1962
2013#define http_req_cookie_ltrl(req, name, val_len) \
2014 http_req_cookie((req), (name), STRLEN_LTRL(name), (val_len))
2015
2078 void *priv);
2079
2115static inline enum http_method_t
2117{
2118 CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
2119 return req->method;
2120}
2121
2163static inline const uint8_t *
2164http_req_path(struct req *req, size_t *len)
2165{
2166 CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
2167 AN(len);
2168
2169 *len = req->path.len;
2170 return req->p->payload + req->path.off;
2171}
2172
2216static inline const uint8_t *
2217http_req_query(struct req *req, size_t *len)
2218{
2219 CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
2220 AN(len);
2221
2222 *len = req->query.len;
2223 if (req->query.len == 0)
2224 return NULL;
2225 return req->p->payload + req->query.off;
2226}
2227
2289const uint8_t * http_req_query_val(const uint8_t *query, size_t query_len,
2290 const uint8_t *name, size_t name_len,
2291 size_t *val_len);
2292
2368err_t http_req_query_iter(const uint8_t *query, size_t len,
2369 name_val_iter_f iter_cb, void *priv);
2370
2407static inline size_t
2409{
2410 CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
2411 return req->clen;
2412}
2413
2518err_t http_req_body(struct http *http, uint8_t buf[], size_t *len, size_t off);
2519
2614err_t http_req_body_ptr(struct http *http, const uint8_t **buf, size_t *len,
2615 size_t off);
2616
2701err_t http_req_chunk(struct http *http, uint8_t *buf, size_t *len);
2702
2729static inline struct resp *
2731{
2732 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
2733 CHECK_OBJ_NOTNULL(&http->resp, RESP_MAGIC);
2734 return &http->resp;
2735}
2736
2774static inline err_t
2775http_resp_set_status(struct resp *resp, uint16_t status)
2776{
2777 CHECK_OBJ_NOTNULL(resp, RESP_MAGIC);
2778 if (status < 100 || status >= 1000)
2779 return ERR_VAL;
2780 resp->status = status;
2781 return ERR_OK;
2782}
2783
2827static inline uint16_t
2829{
2830 CHECK_OBJ_NOTNULL(resp, RESP_MAGIC);
2831 return resp->status;
2832}
2833
2848#ifndef RESP_HDR_SMALL_BUF_SZ
2849#define RESP_HDR_SMALL_BUF_SZ (512)
2850#endif
2851
2869#ifndef RESP_HDR_LARGE_BUF_SZ
2870#define RESP_HDR_LARGE_BUF_SZ (TCP_MSS)
2871#endif
2872
2873#ifdef __DOXYGEN__
2896#define RESP_HDR_SMALL_POOL_SZ (MAX_CONCURRENT_CX_HINT)
2897#endif
2898
2899#ifndef RESP_HDR_SMALL_POOL_SZ
2900#define RESP_HDR_SMALL_POOL_SZ (HTTP_N * SRV_N)
2901#endif
2902
2917#ifndef RESP_HDR_LARGE_POOL_SZ
2918#define RESP_HDR_LARGE_POOL_SZ (RESP_HDR_SMALL_POOL_SZ / 2)
2919#endif
2920
2959err_t http_resp_set_hdr(struct resp *resp, const char *name, size_t name_len,
2960 const char *val, size_t val_len);
2961
3001static inline err_t
3002http_resp_set_hdr_str(struct resp *resp, const char *name, const char *val)
3003{
3004 return http_resp_set_hdr(resp, name, strlen(name), val, strlen(val));
3005}
3006
3046#define http_resp_set_hdr_ltrl(resp, name, val) \
3047 http_resp_set_hdr((resp), (name), STRLEN_LTRL(name), (val), \
3048 STRLEN_LTRL(val))
3049
3086static inline err_t
3087http_resp_set_type(struct resp *resp, const char *type, size_t type_len)
3088{
3089 return http_resp_set_hdr(resp, "Content-Type",
3090 STRLEN_LTRL("Content-Type"), type, type_len);
3091}
3092
3129static inline err_t
3130http_resp_set_type_str(struct resp *resp, const char *type)
3131{
3132 return http_resp_set_type(resp, type, strlen(type));
3133}
3134
3170#define http_resp_set_type_ltrl(resp, type) \
3171 http_resp_set_type((resp), (type), STRLEN_LTRL(type))
3172
3208err_t http_resp_set_len(struct resp *resp, size_t len);
3209
3246static inline err_t
3248{
3249 CHECK_OBJ_NOTNULL(resp, RESP_MAGIC);
3250 return http_resp_set_hdr_ltrl(resp, "Transfer-Encoding", "chunked");
3251}
3252
3293
3380err_t http_resp_send_buf(struct http *http, const uint8_t *buf, size_t len,
3381 bool durable);
3382
3481err_t http_resp_send_chunk(struct http *http, const uint8_t *buf, size_t len,
3482 bool durable);
3483
3536static inline err_t
3537http_resp_err(struct http *http, uint16_t status)
3538{
3539 CHECK_OBJ_NOTNULL(http, HTTP_MAGIC);
3540 CHECK_OBJ_NOTNULL(&http->resp, RESP_MAGIC);
3541
3542 http->resp.status = status;
3543 return http_hndlr_err(http, NULL);
3544}
3545
3644err_t register_hndlr_methods(struct server_cfg *cfg, const char *path,
3645 hndlr_f hndlr, uint8_t methods, void *priv);
3646
3799static inline err_t
3800register_hndlr(struct server_cfg *cfg, const char *path, hndlr_f hndlr,
3801 enum http_method_t method, void *priv)
3802{
3803 if (method < 0 || method >= __HTTP_METHOD_MAX)
3804 return ERR_VAL;
3805 return register_hndlr_methods(cfg, path, hndlr, (1U << method), priv);
3806}
3807
3889err_t register_default_hndlr(struct server_cfg *cfg, hndlr_f hndlr, void *priv,
3890 priv_fini_f fini);
3891
4007err_t register_error_hndlr(struct server_cfg *cfg, hndlr_f hndlr, void *priv,
4008 priv_fini_f fini);
4009
4049err_t format_decimal(char *s, size_t *len, int32_t n);
4050
4099err_t format_hex(char *s, size_t *len, uint32_t n, bool upper);
4100
4191err_t url_decode(char * restrict const out, size_t *outlen,
4192 const char * restrict const in, ssize_t inlen, bool plus);
4193
4230err_t hex_decode(const char * const buf, ssize_t len, uint64_t *n);
4231
4259static inline uint32_t
4260ilog2(uint32_t n)
4261{
4262 AN(n);
4263 return 31 - __builtin_clz(n);
4264}
4265
4294static inline uint32_t
4295ilog10(uint32_t n)
4296{
4297 /*
4298 * Algorithm from Hacker's Delight ch. 11-4, figures 11-12 and 11-13.
4299 * See also Daniel Lemire's blog at:
4300 * https://lemire.me/blog/2021/05/28/computing-the-number-of-digits-of-an-integer-quickly/
4301 */
4302 static const uint32_t nines[] = {
4303 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
4304 };
4305 /* Multiplication by 9/32 roughly approximates division by log2(10). */
4306 uint32_t x = __fast_mul(ilog2(n), 9) >> 5;
4307 /* Fix any off-by-one error. */
4308 return x + bool_to_bit(n > nines[x]);
4309}
4310
4311#endif /* _PICOW_HTTP_H */
#define CHECK_OBJ_NOTNULL(ptr, type_magic)
Assert that a pointer is not NULL, and points to an object that is valid for its type.
Definition: assertion.h:368
#define AN(x)
Assert that a value is not zero, or not NULL
Definition: assertion.h:147
#define PICOW_HTTP_ASSERT(c)
Assert that a condition is true.
Definition: assertion.h:97
const char * http_req_hdr(struct req *req, const char *name, size_t name_len, size_t *val_len)
Return the value of a request header.
static struct req * http_req(struct http *http)
Get the current request object.
Definition: http.h:1331
static const char * http_req_hdr_str(struct req *req, const char *name, size_t *val_len)
Return the value of a request header with a nul-terminated name.
Definition: http.h:1433
http_method_t
Request method.
Definition: http.h:375
bool http_req_hdr_eq(struct req *req, const char *name, size_t name_len, const char *val, size_t val_len)
Return true if a request header value is equal to a string.
static bool http_req_hdr_eq_str(struct req *req, const char *name, const char *val)
Return true if a request header value is equal to a nul-terminated string.
Definition: http.h:1604
err_t http_req_body_ptr(struct http *http, const uint8_t **buf, size_t *len, size_t off)
Get a pointer to request body contents with zero-copy.
err_t http_req_body(struct http *http, uint8_t buf[], size_t *len, size_t off)
Copy the request body to a buffer.
bool http_req_hdr_contains(struct req *req, const char *name, size_t name_len, const char *substring, size_t substring_len)
Return true if a request header contains a string.
err_t http_req_hdr_iter(struct req *req, name_val_iter_f iter_cb, void *priv)
Iterate over request headers.
err_t http_req_query_iter(const uint8_t *query, size_t len, name_val_iter_f iter_cb, void *priv)
Iterate over query string parameter names and values.
err_t url_decode(char *restrict const out, size_t *outlen, const char *restrict const in, ssize_t inlen, bool plus)
Decode a "percent-encoded" string.
err_t http_req_chunk(struct http *http, uint8_t *buf, size_t *len)
Copy the next chunk in a request body sent with chunked encdoding.
static const uint8_t * http_req_cookie_str(struct req *req, const char *name, size_t *val_len)
Return the value of a cookie with a nul-terminated name.
Definition: http.h:1958
static bool http_req_hdr_contains_str(struct req *req, const char *name, const char *substring)
Return true if a request header contains a nul-terminated string.
Definition: http.h:1648
const uint8_t * http_req_cookie(struct req *req, const char *name, size_t name_len, size_t *val_len)
Return the value of a cookie.
static enum http_method_t http_req_method(struct req *req)
Return the request method.
Definition: http.h:2116
const uint8_t * http_req_query_val(const uint8_t *query, size_t query_len, const uint8_t *name, size_t name_len, size_t *val_len)
Return the value of a query parameter.
err_t http_req_cookie_iter(struct req *req, name_val_iter_f iter_cb, void *priv)
Iterate over cooke name/value pairs.
static const uint8_t * http_req_query(struct req *req, size_t *len)
Return the request query string.
Definition: http.h:2217
static const uint8_t * http_req_path(struct req *req, size_t *len)
Return the path from the first request line.
Definition: http.h:2164
err_t(* name_val_iter_f)(const char *name, size_t name_len, const char *val, size_t val_len, void *priv)
Function type for name/value iterators.
Definition: http.h:1780
static size_t http_req_body_len(struct req *req)
Return the length of the request body.
Definition: http.h:2408
static struct resp * http_resp(struct http *http)
Get the current response object.
Definition: http.h:2730
err_t http_resp_send_chunk(struct http *http, const uint8_t *buf, size_t len, bool durable)
Send a chunk in a chunked-encoded response body.
err_t(* hndlr_f)(struct http *http, void *priv)
Function type for custom response handlers.
Definition: http.h:363
#define http_resp_set_hdr_ltrl(resp, name, val)
Set a response header to a literal string.
Definition: http.h:3046
static err_t http_resp_set_hdr_str(struct resp *resp, const char *name, const char *val)
Set a response header to a nul-terminated string.
Definition: http.h:3002
static err_t http_resp_set_type_str(struct resp *resp, const char *type)
Set the Content-Type response header to a nul-terminated string.
Definition: http.h:3130
err_t register_hndlr_methods(struct server_cfg *cfg, const char *path, hndlr_f hndlr, uint8_t methods, void *priv)
Register a response handler for request methods and a path.
err_t http_resp_set_len(struct resp *resp, size_t len)
Set the Content-Length response header.
err_t http_resp_send_hdr(struct http *http)
Send the response header.
static uint16_t http_resp_status(struct resp *resp)
Get the response status code.
Definition: http.h:2828
static err_t http_resp_set_type(struct resp *resp, const char *type, size_t type_len)
Set the Content-Type response header.
Definition: http.h:3087
err_t http_resp_send_buf(struct http *http, const uint8_t *buf, size_t len, bool durable)
Send the contents of a buffer as the response body.
static err_t http_resp_set_xfer_chunked(struct resp *resp)
Set the Transfer-Encdoing response header to "chunked".
Definition: http.h:3247
static err_t http_resp_set_status(struct resp *resp, uint16_t status)
Set the response status code.
Definition: http.h:2775
static err_t http_resp_err(struct http *http, uint16_t status)
Send an error response.
Definition: http.h:3537
err_t register_error_hndlr(struct server_cfg *cfg, hndlr_f hndlr, void *priv, priv_fini_f fini)
Register a custom error response handler.
err_t register_default_hndlr(struct server_cfg *cfg, hndlr_f hndlr, void *priv, priv_fini_f fini)
Register a default response handler.
err_t http_resp_set_hdr(struct resp *resp, const char *name, size_t name_len, const char *val, size_t val_len)
Set a response header.
static err_t register_hndlr(struct server_cfg *cfg, const char *path, hndlr_f hndlr, enum http_method_t method, void *priv)
Register a response handler for a request method and path.
Definition: http.h:3800
http_status_t
enum for HTTP response status codes
Definition: http.h:485
void http_srv_set_priv(struct server *server, void *priv, priv_fini_f *fini)
Set a server-wide private object.
static struct server_cfg http_default_cfg(void)
Get the default HTTP server configuration.
Definition: http.h:895
ip_addr_t * http_srv_ip(struct server *server)
Return the server listener IP address.
static void * http_cx_priv(struct http *http)
Return the connection-scoped private object, if any.
Definition: http.h:471
static uint16_t http_cx_remote_port(struct http *http)
Return the remote port of the current HTTP connection.
Definition: http.h:1253
static uint16_t http_cx_local_port(struct http *http)
Return the local port of the current HTTP connection.
Definition: http.h:1185
static ip_addr_t * http_cx_remote_ip(struct http *http)
Return the remote IP address of the current HTTP connection.
Definition: http.h:1232
static ip_addr_t * http_cx_local_ip(struct http *http)
Return the local IP address of the current HTTP connection.
Definition: http.h:1163
static void http_cx_set_priv(struct http *http, void *priv, priv_fini_f *fini)
Set a connection-scoped private object.
Definition: http.h:446
err_t http_srv_fini(struct server *server)
Stop an HTTP server.
static void * http_srv_priv(struct http *http)
Return the server-wide private object, if any.
Definition: http.h:1297
void priv_fini_f(void *p)
Function type for private data finalizers.
Definition: http.h:416
uint16_t http_srv_port(struct server *server)
Return the server listener port number.
err_t http_cfg(const char *name, struct server_cfg *cfg)
Get the default confiuration for a server by name.
err_t http_srv_init(struct server **server, struct server_cfg *cfg)
Start an HTTP server.
static uint32_t ilog10(uint32_t n)
Return the integer logarithm base 10 of an integer.
Definition: http.h:4295
err_t format_hex(char *s, size_t *len, uint32_t n, bool upper)
Format a hexadecimal number.
#define STRLEN_LTRL(s)
Length of a literal string.
Definition: http.h:656
static uint32_t ilog2(uint32_t n)
Return the integer logarithm base 2 of an integer.
Definition: http.h:4260
err_t format_decimal(char *s, size_t *len, int32_t n)
Format a decimal number.
err_t hex_decode(const char *const buf, ssize_t len, uint64_t *n)
Decode a hexadecimal string.
@ HTTP_METHOD_POST
Definition: http.h:378
@ HTTP_METHOD_HEAD
Definition: http.h:377
@ __HTTP_METHOD_MAX
Definition: http.h:384
@ HTTP_METHOD_CONNECT
Definition: http.h:381
@ HTTP_METHOD_DELETE
Definition: http.h:380
@ HTTP_METHOD_GET
Definition: http.h:376
@ HTTP_METHOD_TRACE
Definition: http.h:383
@ HTTP_METHOD_OPTIONS
Definition: http.h:382
@ HTTP_METHOD_PUT
Definition: http.h:379
@ HTTP_STATUS_URI_TOO_LONG
Definition: http.h:549
@ HTTP_STATUS_IM_A_TEAPOT
Definition: http.h:557
@ HTTP_STATUS_EXPECTATION_FAILED
Definition: http.h:555
@ HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE
Definition: http.h:551
@ HTTP_STATUS_NOT_ACCEPTABLE
Definition: http.h:533
@ HTTP_STATUS_INTERNAL_SERVER_ERROR
Definition: http.h:567
@ HTTP_STATUS_REQUEST_TIMEOUT
Definition: http.h:537
@ HTTP_STATUS_MISDIRECTED_REQUEST
Definition: http.h:559
@ HTTP_STATUS_PROXY_AUTH_REQUIRED
Definition: http.h:535
@ HTTP_STATUS_FORBIDDEN
Definition: http.h:527
@ HTTP_STATUS_CONTENT_TOO_LARGE
Definition: http.h:547
@ HTTP_STATUS_BAD_REQUEST
Definition: http.h:521
@ HTTP_STATUS_RANGE_NOT_SATISFIABLE
Definition: http.h:553
@ HTTP_STATUS_FOUND
Definition: http.h:509
@ HTTP_STATUS_UPGRADE_REQUIRED
Definition: http.h:563
@ HTTP_STATUS_METHOD_NOT_ALLOWED
Definition: http.h:531
@ HTTP_STATUS_REQ_HDR_FIELDS_TOO_LARGE
Definition: http.h:565
@ HTTP_STATUS_GONE
Definition: http.h:541
@ HTTP_STATUS_NOT_MODIFIED
Definition: http.h:513
@ HTTP_STATUS_CONFLICT
Definition: http.h:539
@ HTTP_STATUS_TEMPORARY_REDIRECT
Definition: http.h:517
@ HTTP_STATUS_RESET_CONTENT
Definition: http.h:501
@ HTTP_STATUS_UNPROCESSABLE_CONTENT
Definition: http.h:561
@ HTTP_STATUS_ACCEPTED
Definition: http.h:495
@ HTTP_STATUS_MOVED_PERMANENTLY
Definition: http.h:507
@ HTTP_STATUS_NON_AUTHORITATIVE_INFO
Definition: http.h:497
@ HTTP_STATUS_PARTIAL_CONTENT
Definition: http.h:503
@ HTTP_STATUS_CREATED
Definition: http.h:493
@ HTTP_STATUS_USE_PROXY
Definition: http.h:515
@ HTTP_STATUS_SERVICE_UNAVAILABLE
Definition: http.h:573
@ HTTP_STATUS_LENGTH_REQUIRED
Definition: http.h:543
@ HTTP_STATUS_SWITCHING_PROTOCOLS
Definition: http.h:489
@ HTTP_STATUS_PERMANENT_REDIRECT
Definition: http.h:519
@ HTTP_STATUS_PRECONDITION_FAILED
Definition: http.h:545
@ HTTP_STATUS_BAD_GATEWAY
Definition: http.h:571
@ HTTP_STATUS_NOT_IMPLEMENTED
Definition: http.h:569
@ HTTP_STATUS_MULTIPLE_CHOICES
Definition: http.h:505
@ HTTP_STATUS_NO_CONTENT
Definition: http.h:499
@ HTTP_STATUS_OK
Definition: http.h:491
@ HTTP_STATUS_CONTINUE
Definition: http.h:487
@ HTTP_STATUS_UNAUTHORIZED
Definition: http.h:523
@ HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED
Definition: http.h:577
@ HTTP_STATUS_SEE_OTHER
Definition: http.h:511
@ HTTP_STATUS_GATEWAY_TIMEOUT
Definition: http.h:575
@ HTTP_STATUS_NOT_FOUND
Definition: http.h:529
@ HTTP_STATUS_PAYMENT_REQUIRED
Definition: http.h:525
Current HTTP connection, request and response.
NTP configuration.
Definition: ntp.h:174
HTTP request.
HTTP response.
HTTP server configuration.
Definition: http.h:768
unsigned idle_tmo_s
Definition: http.h:782
unsigned send_tmo_s
Definition: http.h:784
bool tls
Definition: http.h:792
uint8_t listen_backlog
Definition: http.h:788
const ip_addr_t * ipaddr
Definition: http.h:772
enum lwip_ip_addr_type ip_type
Definition: http.h:790
uint16_t port
Definition: http.h:786
HTTP server.