libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-http.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2020 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25/* minimal space for typical headers and CSP stuff */
26
27#define LWS_RECOMMENDED_MIN_HEADER_SPACE 2048
28
34
41
53LWS_VISIBLE LWS_EXTERN const char *
54lws_get_mimetype(const char *file, const struct lws_http_mount *m);
55
65#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2) || defined(LWS_ROLE_H3)
67lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len);
68#endif
69
89lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
90 const char *other_headers, int other_headers_len);
91
95
96
138
148
150 char *p;
151 int len;
153 int final;
156};
157
158typedef const char *(*lws_process_html_state_cb)(void *data, int index);
159
161 char *start;
162 char swallow[16];
164 int pos;
165 void *data;
166 const char * const *vars;
168
171};
172
186 struct lws_process_html_state *s);
188
226
234 unsigned char *token;
235 int len;
236};
237
238/* enum lws_token_indexes
239 * these have to be kept in sync with lextable.h / minilex.c
240 *
241 * NOTE: These public enums are part of the abi. If you want to add one,
242 * add it at where specified so existing users are unaffected.
243 */
247#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
248 WSI_TOKEN_OPTIONS_URI,
249#endif
254#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
255 WSI_TOKEN_DRAFT,
256#endif
258#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
259 WSI_TOKEN_EXTENSIONS,
260 WSI_TOKEN_KEY1, /* 10 */
261 WSI_TOKEN_KEY2,
262 WSI_TOKEN_PROTOCOL,
263 WSI_TOKEN_ACCEPT,
264 WSI_TOKEN_NONCE,
265#endif
267#if defined(LWS_ROLE_H2) || defined(LWS_ROLE_H3) || defined(LWS_HTTP_HEADERS_ALL)
268 WSI_TOKEN_HTTP2_SETTINGS, /* 16 */
269#endif
271#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
272 WSI_TOKEN_HTTP_AC_REQUEST_HEADERS,
273#endif
286#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
287 WSI_TOKEN_HTTP_REFERER,
288#endif
289#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
290 WSI_TOKEN_KEY,
291 WSI_TOKEN_VERSION,
292 WSI_TOKEN_SWORIGIN,
293#endif
294#if defined(LWS_ROLE_H2) || defined(LWS_ROLE_H3) || defined(LWS_HTTP_HEADERS_ALL)
295 WSI_TOKEN_HTTP_COLON_AUTHORITY,
296 WSI_TOKEN_HTTP_COLON_METHOD,
297 WSI_TOKEN_HTTP_COLON_PATH,
298 WSI_TOKEN_HTTP_COLON_SCHEME,
299 WSI_TOKEN_HTTP_COLON_STATUS,
300#endif
301
302#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
303 WSI_TOKEN_HTTP_ACCEPT_CHARSET,
304#endif
306#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
307 WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN,
308#endif
326#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
327 WSI_TOKEN_HTTP_MAX_FORWARDS,
328 WSI_TOKEN_HTTP_PROXY_AUTHENTICATE,
329 WSI_TOKEN_HTTP_PROXY_AUTHORIZATION,
330#endif
335#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
336 WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY,
337#endif
339#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
340 WSI_TOKEN_HTTP_USER_AGENT,
341 WSI_TOKEN_HTTP_VARY,
342 WSI_TOKEN_HTTP_VIA,
343 WSI_TOKEN_HTTP_WWW_AUTHENTICATE,
344#endif
345#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
346 WSI_TOKEN_PATCH_URI,
347 WSI_TOKEN_PUT_URI,
348 WSI_TOKEN_DELETE_URI,
349#endif
350
352#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
353 WSI_TOKEN_PROXY,
354 WSI_TOKEN_HTTP_X_REAL_IP,
355#endif
360#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
361 WSI_TOKEN_TE,
362 WSI_TOKEN_REPLAY_NONCE, /* ACME */
363#endif
364#if defined(LWS_ROLE_H2) || defined(LWS_ROLE_H3) || defined(LWS_HTTP_HEADERS_ALL)
365 WSI_TOKEN_COLON_PROTOCOL,
366#endif
369
370 /****** add new things just above ---^ ******/
371
372 /* use token storage to stash these internally, not for
373 * user use */
374
384
385 /* always last real token index*/
387
388 /* parser state additions, no storage associated */
390#if defined(LWS_WITH_CUSTOM_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
391 WSI_TOKEN_UNKNOWN_VALUE_PART,
392#endif
397};
398
400 unsigned short token_limit[WSI_TOKEN_COUNT];
401};
402
415
421LWS_VISIBLE LWS_EXTERN const unsigned char *
423
434
442lws_hdr_extant(struct lws *wsi, enum lws_token_indexes h);
443
455 int frag_idx);
456
472lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
473
492lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
493 enum lws_token_indexes h, int frag_idx);
494
512lws_hdr_custom_length(struct lws *wsi, const char *name, int nlen);
513
533lws_hdr_custom_copy(struct lws *wsi, char *dst, int len, const char *name,
534 int nlen);
535
536typedef void (*lws_hdr_custom_fe_cb_t)(const char *name, int nlen, void *opaque);
554lws_hdr_custom_name_foreach(struct lws *wsi, lws_hdr_custom_fe_cb_t cb, void *opaque);
555
605lws_get_urlarg_by_name_safe(struct lws *wsi, const char *name, char *buf, int len);
606
627LWS_VISIBLE LWS_EXTERN const char *
628lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
629/* LWS_WARN_DEPRECATED */;
630
645lws_http_remove_urlarg(struct lws *wsi, const char *name);
646
661lws_http_zap_header(struct lws *wsi, const char *name);
662
689lws_http_add_onward_header(struct lws *wsi, const char *name,
690 const char *value);
691
716lws_http_get_onward_header(struct lws *wsi, const char *name, char *buf,
717 size_t len);
718
720
755#define LWS_LOGIN_HDR_STATE "x-lws-login-state"
756#define LWS_LOGIN_HDR_ADMIN "x-lws-login-admin"
757#define LWS_LOGIN_HDR_GRANT_LEVEL "x-lws-login-grant-level"
758#define LWS_LOGIN_HDR_SUB "x-lws-login-sub"
759
781
782
798
799#define LWSAHH_CODE_MASK ((1 << 16) - 1)
800#define LWSAHH_FLAG_NO_SERVER_NAME (1 << 30)
801
818 unsigned int code, unsigned char **p,
819 unsigned char *end);
848lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
849 const unsigned char *value, int length,
850 unsigned char **p, unsigned char *end);
869 const unsigned char *value, int length,
870 unsigned char **p, unsigned char *end);
883 lws_filepos_t content_length,
884 unsigned char **p, unsigned char *end);
895lws_finalize_http_header(struct lws *wsi, unsigned char **p,
896 unsigned char *end);
897
919lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
920 unsigned char **p, unsigned char *end);
921
922#define LWS_ILLEGAL_HTTP_CONTENT_LEN ((lws_filepos_t)-1ll)
923
951lws_add_http_common_headers(struct lws *wsi, unsigned int code,
952 const char *content_type, lws_filepos_t content_len,
953 unsigned char **p, unsigned char *end);
954
955enum {
965};
966
979
981lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len);
982
984
995
1006LWS_VISIBLE LWS_EXTERN const char *
1007lws_urlencode(char *escaped, const char *string, int len);
1008
1009/*
1010 * URLDECODE 1 / 2
1011 *
1012 * This simple urldecode only operates until the first '\0' and requires the
1013 * data to exist all at once
1014 */
1031lws_urldecode(char *string, const char *escaped, int len);
1033
1045lws_http_date_render_from_unix(char *buf, size_t len, const time_t *t);
1046
1058lws_http_date_parse_unix(const char *b, size_t len, time_t *t);
1059
1079lws_http_check_retry_after(struct lws *wsi, lws_usec_t *us_interval_in_out);
1080
1091lws_return_http_status(struct lws *wsi, unsigned int code,
1092 const char *html_body);
1093
1107lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
1108 unsigned char **p, unsigned char *end);
1109
1120
1130
1140lws_http_mark_sse(struct lws *wsi);
1141
1159
1186lws_http_compression_apply(struct lws *wsi, const char *name,
1187 unsigned char **p, unsigned char *end, char decomp);
1188
1199
1220lws_http_cookie_get(struct lws *wsi, const char *name, char *buf, size_t *max);
1221
1247lws_http_cookie_get_nth(struct lws *wsi, const char *name, int n,
1248 char *buf, size_t *max);
1249
1281lws_http_cookie_compose(char *buf, size_t len, const char *name,
1282 const char *value, const char *domain,
1283 unsigned long long max_age, const char *expires);
1284
1293#define lws_http_client_http_resp_is_error(code) (!(code < 400))
1294
1320#define LWS_H2_STREAM_SID -1
1322lws_h2_update_peer_txcredit(struct lws *wsi, unsigned int sid, int bump);
1323
1324
1338
1339
1363
1379
1381
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_finalize_write_http_header(struct lws *wsi, unsigned char *start, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_status(struct lws *wsi, unsigned int code, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name, const unsigned char *value, int length, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_finalize_http_header(struct lws *wsi, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_common_headers(struct lws *wsi, unsigned int code, const char *content_type, lws_filepos_t content_len, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_content_length(struct lws *wsi, lws_filepos_t content_length, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token, const unsigned char *value, int length, unsigned char **p, unsigned char *end)
@ LWSHUMETH_CONNECT
Definition lws-http.h:962
@ LWSHUMETH_HEAD
Definition lws-http.h:963
@ LWSHUMETH_OPTIONS
Definition lws-http.h:958
@ LWSHUMETH_COLON_PATH
Definition lws-http.h:964
@ LWSHUMETH_PATCH
Definition lws-http.h:960
@ LWSHUMETH_PUT
Definition lws-http.h:959
@ LWSHUMETH_GET
Definition lws-http.h:956
@ LWSHUMETH_POST
Definition lws-http.h:957
@ LWSHUMETH_DELETE
Definition lws-http.h:961
unsigned short token_limit[WSI_TOKEN_COUNT]
Definition lws-http.h:400
unsigned char * token
Definition lws-http.h:234
LWS_VISIBLE LWS_EXTERN int lws_hdr_custom_copy(struct lws *wsi, char *dst, int len, const char *name, int nlen)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_hdr_extant(struct lws *wsi, enum lws_token_indexes h)
LWS_VISIBLE LWS_EXTERN int lws_hdr_custom_name_foreach(struct lws *wsi, lws_hdr_custom_fe_cb_t cb, void *opaque)
LWS_VISIBLE LWS_EXTERN int lws_get_urlarg_by_name_safe(struct lws *wsi, const char *name, char *buf, int len)
void(* lws_hdr_custom_fe_cb_t)(const char *name, int nlen, void *opaque)
Definition lws-http.h:536
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx)
LWS_VISIBLE LWS_EXTERN int lws_hdr_custom_length(struct lws *wsi, const char *name, int nlen)
LWS_VISIBLE LWS_EXTERN int lws_http_remove_urlarg(struct lws *wsi, const char *name)
LWS_VISIBLE LWS_EXTERN int lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h)
lws_token_indexes
Definition lws-http.h:244
LWS_VISIBLE LWS_EXTERN const char * lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)
LWS_VISIBLE LWS_EXTERN int lws_http_get_onward_header(struct lws *wsi, const char *name, char *buf, size_t len)
LWS_VISIBLE LWS_EXTERN int lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len, enum lws_token_indexes h, int frag_idx)
LWS_VISIBLE LWS_EXTERN int lws_http_add_onward_header(struct lws *wsi, const char *name, const char *value)
LWS_VISIBLE LWS_EXTERN const unsigned char * lws_token_to_string(enum lws_token_indexes token)
lws_h2_settings
Definition lws-http.h:403
LWS_VISIBLE LWS_EXTERN int lws_http_zap_header(struct lws *wsi, const char *name)
@ WSI_TOKEN_HTTP_LAST_MODIFIED
Definition lws-http.h:323
@ WSI_TOKEN_HTTP_CONTENT_LENGTH
Definition lws-http.h:282
@ WSI_TOKEN_HTTP_CONTENT_LANGUAGE
Definition lws-http.h:313
@ _WSI_TOKEN_CLIENT_ALPN
Definition lws-http.h:383
@ _WSI_TOKEN_CLIENT_SENT_PROTOCOLS
Definition lws-http.h:375
@ WSI_TOKEN_HTTP_EXPECT
Definition lws-http.h:317
@ _WSI_TOKEN_CLIENT_LOCALPORT
Definition lws-http.h:382
@ WSI_TOKEN_HTTP_FROM
Definition lws-http.h:319
@ WSI_TOKEN_DSS_SIGNATURE
Definition lws-http.h:368
@ _WSI_TOKEN_CLIENT_URI
Definition lws-http.h:377
@ WSI_TOKEN_HTTP_ETAG
Definition lws-http.h:316
@ _WSI_TOKEN_CLIENT_HOST
Definition lws-http.h:378
@ WSI_TOKEN_HTTP_CONTENT_DISPOSITION
Definition lws-http.h:311
@ WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE
Definition lws-http.h:322
@ _WSI_TOKEN_CLIENT_METHOD
Definition lws-http.h:380
@ WSI_TOKEN_HTTP_IF_MATCH
Definition lws-http.h:320
@ WSI_TOKEN_HTTP_ACCEPT
Definition lws-http.h:270
@ WSI_INIT_TOKEN_MUXURL
Definition lws-http.h:396
@ WSI_PARSING_COMPLETE
Definition lws-http.h:395
@ WSI_TOKEN_HTTP_SET_COOKIE
Definition lws-http.h:334
@ WSI_TOKEN_X_AUTH_TOKEN
Definition lws-http.h:367
@ WSI_TOKEN_HTTP_LINK
Definition lws-http.h:324
@ WSI_TOKEN_HTTP_ACCEPT_LANGUAGE
Definition lws-http.h:277
@ WSI_TOKEN_HTTP_SERVER
Definition lws-http.h:333
@ WSI_TOKEN_HTTP_CONTENT_ENCODING
Definition lws-http.h:312
@ WSI_TOKEN_HTTP_IF_NONE_MATCH
Definition lws-http.h:275
@ WSI_TOKEN_HTTP_IF_RANGE
Definition lws-http.h:321
@ _WSI_TOKEN_CLIENT_PEER_ADDRESS
Definition lws-http.h:376
@ WSI_TOKEN_HTTP_ALLOW
Definition lws-http.h:310
@ WSI_TOKEN_HTTP_CONTENT_LOCATION
Definition lws-http.h:314
@ WSI_TOKEN_HTTP_ACCEPT_RANGES
Definition lws-http.h:305
@ WSI_TOKEN_HOST
Definition lws-http.h:250
@ WSI_TOKEN_HTTP_TRANSFER_ENCODING
Definition lws-http.h:338
@ WSI_TOKEN_HTTP
Definition lws-http.h:266
@ WSI_TOKEN_HTTP_URI_ARGS
Definition lws-http.h:351
@ WSI_TOKEN_POST_URI
Definition lws-http.h:246
@ WSI_TOKEN_HTTP_RETRY_AFTER
Definition lws-http.h:332
@ WSI_TOKEN_HTTP_EXPIRES
Definition lws-http.h:318
@ WSI_TOKEN_HTTP_IF_MODIFIED_SINCE
Definition lws-http.h:274
@ WSI_TOKEN_HEAD_URI
Definition lws-http.h:359
@ WSI_TOKEN_COUNT
Definition lws-http.h:386
@ WSI_TOKEN_HTTP_COOKIE
Definition lws-http.h:281
@ WSI_TOKEN_HTTP_CONTENT_RANGE
Definition lws-http.h:315
@ WSI_TOKEN_HTTP_CACHE_CONTROL
Definition lws-http.h:279
@ WSI_TOKEN_SKIPPING_SAW_CR
Definition lws-http.h:394
@ WSI_TOKEN_HTTP_REFRESH
Definition lws-http.h:331
@ WSI_TOKEN_HTTP_RANGE
Definition lws-http.h:285
@ _WSI_TOKEN_CLIENT_ORIGIN
Definition lws-http.h:379
@ WSI_TOKEN_NAME_PART
Definition lws-http.h:389
@ WSI_TOKEN_UPGRADE
Definition lws-http.h:252
@ WSI_TOKEN_X_FORWARDED_FOR
Definition lws-http.h:357
@ WSI_TOKEN_SKIPPING
Definition lws-http.h:393
@ WSI_TOKEN_CONNECT
Definition lws-http.h:358
@ WSI_TOKEN_CONNECTION
Definition lws-http.h:251
@ WSI_TOKEN_HTTP_ACCEPT_ENCODING
Definition lws-http.h:276
@ WSI_TOKEN_ORIGIN
Definition lws-http.h:253
@ WSI_TOKEN_HTTP_CONTENT_TYPE
Definition lws-http.h:283
@ WSI_TOKEN_HTTP_LOCATION
Definition lws-http.h:325
@ WSI_TOKEN_HTTP_AUTHORIZATION
Definition lws-http.h:280
@ WSI_TOKEN_GET_URI
Definition lws-http.h:245
@ WSI_TOKEN_HTTP_AGE
Definition lws-http.h:309
@ WSI_TOKEN_HTTP_DATE
Definition lws-http.h:284
@ WSI_TOKEN_HTTP_PRAGMA
Definition lws-http.h:278
@ WSI_TOKEN_CHALLENGE
Definition lws-http.h:257
@ WSI_TOKEN_HTTP1_0
Definition lws-http.h:356
@ _WSI_TOKEN_CLIENT_IFACE
Definition lws-http.h:381
@ H2SET_MAX_HEADER_LIST_SIZE
Definition lws-http.h:409
@ H2SET_HEADER_TABLE_SIZE
Definition lws-http.h:404
@ H2SET_MAX_CONCURRENT_STREAMS
Definition lws-http.h:406
@ H2SET_INITIAL_WINDOW_SIZE
Definition lws-http.h:407
@ H2SET_ENABLE_PUSH
Definition lws-http.h:405
@ H2SET_MAX_FRAME_SIZE
Definition lws-http.h:408
@ H2SET_COUNT
Definition lws-http.h:413
@ H2SET_ENABLE_CONNECT_PROTOCOL
Definition lws-http.h:411
@ H2SET_RESERVED7
Definition lws-http.h:410
lws_login_state
Definition lws-http.h:767
@ LWS_LOGIN_STATE_USER
Definition lws-http.h:773
@ LWS_LOGIN_STATE_NO_GRANT
Definition lws-http.h:771
@ LWS_LOGIN_STATE_ANON
Definition lws-http.h:769
@ LWS_LOGIN_STATE_APP_ADMIN
Definition lws-http.h:776
@ LWS_LOGIN_STATE_GLOBAL_ADMIN
Definition lws-http.h:779
unsigned int uint32_t
#define LWS_EXTERN
int64_t lws_usec_t
#define LWS_WARN_UNUSED_RESULT
#define LWS_VISIBLE
unsigned long long lws_filepos_t
LWS_VISIBLE LWS_EXTERN const char * lws_get_mimetype(const char *file, const struct lws_http_mount *m)
LWS_VISIBLE LWS_EXTERN int lws_http_compression_apply(struct lws *wsi, const char *name, unsigned char **p, unsigned char *end, char decomp)
LWS_VISIBLE LWS_EXTERN int lws_http_mark_sse(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_http_date_parse_unix(const char *b, size_t len, time_t *t)
LWS_VISIBLE LWS_EXTERN int lws_serve_http_file_fragment(struct lws *wsi)
const char *const * vars
Definition lws-http.h:166
LWS_VISIBLE LWS_EXTERN int lws_http_check_retry_after(struct lws *wsi, lws_usec_t *us_interval_in_out)
LWS_VISIBLE LWS_EXTERN int lws_chunked_html_process(struct lws_process_html_args *args, struct lws_process_html_state *s)
lws_process_html_state_cb replace
Definition lws-http.h:169
LWS_VISIBLE LWS_EXTERN uint32_t lws_h2_get_peer_rst_status(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len, unsigned char **p, unsigned char *end)
LWS_VISIBLE LWS_EXTERN int lws_h2_get_peer_txcredit_estimate(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_http_cookie_compose(char *buf, size_t len, const char *name, const char *value, const char *domain, unsigned long long max_age, const char *expires)
LWS_VISIBLE LWS_EXTERN int lws_http_date_render_from_unix(char *buf, size_t len, const time_t *t)
LWS_VISIBLE LWS_EXTERN int lws_urldecode(char *string, const char *escaped, int len)
lws_h2_errors
Definition lws-http.h:1347
@ H2_ERR_NO_ERROR
Definition lws-http.h:1348
@ H2_ERR_CONNECT_ERROR
Definition lws-http.h:1358
@ H2_ERR_CANCEL
Definition lws-http.h:1356
@ H2_ERR_COMPRESSION_ERROR
Definition lws-http.h:1357
@ H2_ERR_FLOW_CONTROL_ERROR
Definition lws-http.h:1351
@ H2_ERR_HTTP_1_1_REQUIRED
Definition lws-http.h:1361
@ H2_ERR_FRAME_SIZE_ERROR
Definition lws-http.h:1354
@ H2_ERR_REFUSED_STREAM
Definition lws-http.h:1355
@ H2_ERR_INTERNAL_ERROR
Definition lws-http.h:1350
@ H2_ERR_ENHANCE_YOUR_CALM
Definition lws-http.h:1359
@ H2_ERR_INADEQUATE_SECURITY
Definition lws-http.h:1360
@ H2_ERR_PROTOCOL_ERROR
Definition lws-http.h:1349
@ H2_ERR_SETTINGS_TIMEOUT
Definition lws-http.h:1352
@ H2_ERR_STREAM_CLOSED
Definition lws-http.h:1353
LWS_VISIBLE LWS_EXTERN const char * lws_urlencode(char *escaped, const char *string, int len)
LWS_VISIBLE LWS_EXTERN int lws_h2_update_peer_txcredit(struct lws *wsi, unsigned int sid, int bump)
LWS_VISIBLE LWS_EXTERN int lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type, const char *other_headers, int other_headers_len)
LWS_VISIBLE LWS_EXTERN int lws_http_cookie_get_nth(struct lws *wsi, const char *name, int n, char *buf, size_t *max)
http_status
Definition lws-http.h:97
@ HTTP_STATUS_EXPECTATION_FAILED
Definition lws-http.h:126
@ HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE
Definition lws-http.h:124
@ HTTP_STATUS_NOT_ACCEPTABLE
Definition lws-http.h:115
@ HTTP_STATUS_REQ_URI_TOO_LONG
Definition lws-http.h:123
@ HTTP_STATUS_INTERNAL_SERVER_ERROR
Definition lws-http.h:131
@ HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE
Definition lws-http.h:125
@ HTTP_STATUS_REQUEST_TIMEOUT
Definition lws-http.h:117
@ HTTP_STATUS_PROXY_AUTH_REQUIRED
Definition lws-http.h:116
@ HTTP_STATUS_FORBIDDEN
Definition lws-http.h:112
@ HTTP_STATUS_BAD_REQUEST
Definition lws-http.h:109
@ HTTP_STATUS_FOUND
Definition lws-http.h:105
@ HTTP_STATUS_UPGRADE_REQUIRED
Definition lws-http.h:128
@ HTTP_STATUS_METHOD_NOT_ALLOWED
Definition lws-http.h:114
@ HTTP_STATUS_GONE
Definition lws-http.h:119
@ HTTP_STATUS_NOT_MODIFIED
Definition lws-http.h:107
@ HTTP_STATUS_CONFLICT
Definition lws-http.h:118
@ HTTP_STATUS_MOVED_PERMANENTLY
Definition lws-http.h:104
@ HTTP_STATUS_PARTIAL_CONTENT
Definition lws-http.h:102
@ HTTP_STATUS_REQ_HEADER_FIELDS_TOO_LARGE
Definition lws-http.h:129
@ HTTP_STATUS_REQ_ENTITY_TOO_LARGE
Definition lws-http.h:122
@ HTTP_STATUS_SERVICE_UNAVAILABLE
Definition lws-http.h:134
@ HTTP_STATUS_LENGTH_REQUIRED
Definition lws-http.h:120
@ HTTP_STATUS_PRECONDITION_FAILED
Definition lws-http.h:121
@ HTTP_STATUS_BAD_GATEWAY
Definition lws-http.h:133
@ HTTP_STATUS_NOT_IMPLEMENTED
Definition lws-http.h:132
@ HTTP_STATUS_NO_CONTENT
Definition lws-http.h:101
@ HTTP_STATUS_OK
Definition lws-http.h:100
@ HTTP_STATUS_CONTINUE
Definition lws-http.h:98
@ HTTP_STATUS_UNAUTHORIZED
Definition lws-http.h:110
@ HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED
Definition lws-http.h:136
@ HTTP_STATUS_SEE_OTHER
Definition lws-http.h:106
@ HTTP_STATUS_GATEWAY_TIMEOUT
Definition lws-http.h:135
@ HTTP_STATUS_NOT_FOUND
Definition lws-http.h:113
@ HTTP_STATUS_PAYMENT_REQUIRED
Definition lws-http.h:111
LWS_VISIBLE LWS_EXTERN int lws_return_http_status(struct lws *wsi, unsigned int code, const char *html_body)
LWS_VISIBLE LWS_EXTERN int lws_http_is_redirected_to_get(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_http_transaction_completed(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN int lws_http_cookie_get(struct lws *wsi, const char *name, char *buf, size_t *max)
LWS_VISIBLE LWS_EXTERN int lws_http_headers_detach(struct lws *wsi)
const char *(* lws_process_html_state_cb)(void *data, int index)
Definition lws-http.h:158
LWS_VISIBLE LWS_EXTERN int lws_h2_client_stream_long_poll_rxonly(struct lws *wsi)