libwebsockets
Lightweight C library for HTML5 websockets
lws-http.h
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
74LWS_VISIBLE LWS_EXTERN int
75lws_serve_http_file(struct lws *wsi, const char *file, const char *content_type,
76 const char *other_headers, int other_headers_len);
77
78LWS_VISIBLE LWS_EXTERN int
79lws_serve_http_file_fragment(struct lws *wsi);
81
82
83enum http_status {
84 HTTP_STATUS_CONTINUE = 100,
85
86 HTTP_STATUS_OK = 200,
87 HTTP_STATUS_NO_CONTENT = 204,
88 HTTP_STATUS_PARTIAL_CONTENT = 206,
89
90 HTTP_STATUS_MOVED_PERMANENTLY = 301,
91 HTTP_STATUS_FOUND = 302,
92 HTTP_STATUS_SEE_OTHER = 303,
93 HTTP_STATUS_NOT_MODIFIED = 304,
94
95 HTTP_STATUS_BAD_REQUEST = 400,
96 HTTP_STATUS_UNAUTHORIZED,
97 HTTP_STATUS_PAYMENT_REQUIRED,
98 HTTP_STATUS_FORBIDDEN,
99 HTTP_STATUS_NOT_FOUND,
100 HTTP_STATUS_METHOD_NOT_ALLOWED,
101 HTTP_STATUS_NOT_ACCEPTABLE,
102 HTTP_STATUS_PROXY_AUTH_REQUIRED,
103 HTTP_STATUS_REQUEST_TIMEOUT,
104 HTTP_STATUS_CONFLICT,
105 HTTP_STATUS_GONE,
106 HTTP_STATUS_LENGTH_REQUIRED,
107 HTTP_STATUS_PRECONDITION_FAILED,
108 HTTP_STATUS_REQ_ENTITY_TOO_LARGE,
109 HTTP_STATUS_REQ_URI_TOO_LONG,
110 HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE,
111 HTTP_STATUS_REQ_RANGE_NOT_SATISFIABLE,
112 HTTP_STATUS_EXPECTATION_FAILED,
113
114 HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
115 HTTP_STATUS_NOT_IMPLEMENTED,
116 HTTP_STATUS_BAD_GATEWAY,
117 HTTP_STATUS_SERVICE_UNAVAILABLE,
118 HTTP_STATUS_GATEWAY_TIMEOUT,
119 HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED,
120};
131
133 char *p;
134 int len;
136 int final;
139};
140
141typedef const char *(*lws_process_html_state_cb)(void *data, int index);
142
144 char *start;
145 char swallow[16];
146 int pos;
147 void *data;
148 const char * const *vars;
150
151 lws_process_html_state_cb replace;
153};
154
159LWS_VISIBLE LWS_EXTERN int
160lws_chunked_html_process(struct lws_process_html_args *args,
161 struct lws_process_html_state *s);
163
197
205 unsigned char *token;
206 int len;
207};
208
209/* enum lws_token_indexes
210 * these have to be kept in sync with lextable.h / minilex.c
211 *
212 * NOTE: These public enums are part of the abi. If you want to add one,
213 * add it at where specified so existing users are unaffected.
214 */
215enum lws_token_indexes {
216 WSI_TOKEN_GET_URI, /* 0 */
217 WSI_TOKEN_POST_URI,
218#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
219 WSI_TOKEN_OPTIONS_URI,
220#endif
221 WSI_TOKEN_HOST,
222 WSI_TOKEN_CONNECTION,
223 WSI_TOKEN_UPGRADE, /* 5 */
224 WSI_TOKEN_ORIGIN,
225#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
226 WSI_TOKEN_DRAFT,
227#endif
228 WSI_TOKEN_CHALLENGE,
229#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
230 WSI_TOKEN_EXTENSIONS,
231 WSI_TOKEN_KEY1, /* 10 */
232 WSI_TOKEN_KEY2,
233 WSI_TOKEN_PROTOCOL,
234 WSI_TOKEN_ACCEPT,
235 WSI_TOKEN_NONCE,
236#endif
237 WSI_TOKEN_HTTP,
238#if defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
239 WSI_TOKEN_HTTP2_SETTINGS, /* 16 */
240#endif
241 WSI_TOKEN_HTTP_ACCEPT,
242#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
243 WSI_TOKEN_HTTP_AC_REQUEST_HEADERS,
244#endif
245 WSI_TOKEN_HTTP_IF_MODIFIED_SINCE,
246 WSI_TOKEN_HTTP_IF_NONE_MATCH, /* 20 */
247 WSI_TOKEN_HTTP_ACCEPT_ENCODING,
248 WSI_TOKEN_HTTP_ACCEPT_LANGUAGE,
249 WSI_TOKEN_HTTP_PRAGMA,
250 WSI_TOKEN_HTTP_CACHE_CONTROL,
251 WSI_TOKEN_HTTP_AUTHORIZATION,
252 WSI_TOKEN_HTTP_COOKIE,
253 WSI_TOKEN_HTTP_CONTENT_LENGTH, /* 27 */
254 WSI_TOKEN_HTTP_CONTENT_TYPE,
255 WSI_TOKEN_HTTP_DATE,
256 WSI_TOKEN_HTTP_RANGE,
257#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
258 WSI_TOKEN_HTTP_REFERER,
259#endif
260#if defined(LWS_ROLE_WS) || defined(LWS_HTTP_HEADERS_ALL)
261 WSI_TOKEN_KEY,
262 WSI_TOKEN_VERSION,
263 WSI_TOKEN_SWORIGIN,
264#endif
265#if defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
266 WSI_TOKEN_HTTP_COLON_AUTHORITY,
267 WSI_TOKEN_HTTP_COLON_METHOD,
268 WSI_TOKEN_HTTP_COLON_PATH,
269 WSI_TOKEN_HTTP_COLON_SCHEME,
270 WSI_TOKEN_HTTP_COLON_STATUS,
271#endif
272
273#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
274 WSI_TOKEN_HTTP_ACCEPT_CHARSET,
275#endif
276 WSI_TOKEN_HTTP_ACCEPT_RANGES,
277#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
278 WSI_TOKEN_HTTP_ACCESS_CONTROL_ALLOW_ORIGIN,
279#endif
280 WSI_TOKEN_HTTP_AGE,
281 WSI_TOKEN_HTTP_ALLOW,
282 WSI_TOKEN_HTTP_CONTENT_DISPOSITION,
283 WSI_TOKEN_HTTP_CONTENT_ENCODING,
284 WSI_TOKEN_HTTP_CONTENT_LANGUAGE,
285 WSI_TOKEN_HTTP_CONTENT_LOCATION,
286 WSI_TOKEN_HTTP_CONTENT_RANGE,
287 WSI_TOKEN_HTTP_ETAG,
288 WSI_TOKEN_HTTP_EXPECT,
289 WSI_TOKEN_HTTP_EXPIRES,
290 WSI_TOKEN_HTTP_FROM,
291 WSI_TOKEN_HTTP_IF_MATCH,
292 WSI_TOKEN_HTTP_IF_RANGE,
293 WSI_TOKEN_HTTP_IF_UNMODIFIED_SINCE,
294 WSI_TOKEN_HTTP_LAST_MODIFIED,
295 WSI_TOKEN_HTTP_LINK,
296 WSI_TOKEN_HTTP_LOCATION,
297#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
298 WSI_TOKEN_HTTP_MAX_FORWARDS,
299 WSI_TOKEN_HTTP_PROXY_AUTHENTICATE,
300 WSI_TOKEN_HTTP_PROXY_AUTHORIZATION,
301#endif
302 WSI_TOKEN_HTTP_REFRESH,
303 WSI_TOKEN_HTTP_RETRY_AFTER,
304 WSI_TOKEN_HTTP_SERVER,
305 WSI_TOKEN_HTTP_SET_COOKIE,
306#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
307 WSI_TOKEN_HTTP_STRICT_TRANSPORT_SECURITY,
308#endif
309 WSI_TOKEN_HTTP_TRANSFER_ENCODING,
310#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
311 WSI_TOKEN_HTTP_USER_AGENT,
312 WSI_TOKEN_HTTP_VARY,
313 WSI_TOKEN_HTTP_VIA,
314 WSI_TOKEN_HTTP_WWW_AUTHENTICATE,
315#endif
316#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
317 WSI_TOKEN_PATCH_URI,
318 WSI_TOKEN_PUT_URI,
319 WSI_TOKEN_DELETE_URI,
320#endif
321
322 WSI_TOKEN_HTTP_URI_ARGS,
323#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
324 WSI_TOKEN_PROXY,
325 WSI_TOKEN_HTTP_X_REAL_IP,
326#endif
327 WSI_TOKEN_HTTP1_0,
328 WSI_TOKEN_X_FORWARDED_FOR,
329 WSI_TOKEN_CONNECT,
330 WSI_TOKEN_HEAD_URI,
331#if defined(LWS_WITH_HTTP_UNCOMMON_HEADERS) || defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
332 WSI_TOKEN_TE,
333 WSI_TOKEN_REPLAY_NONCE, /* ACME */
334#endif
335#if defined(LWS_ROLE_H2) || defined(LWS_HTTP_HEADERS_ALL)
336 WSI_TOKEN_COLON_PROTOCOL,
337#endif
338 WSI_TOKEN_X_AUTH_TOKEN,
339 WSI_TOKEN_DSS_SIGNATURE,
340
341 /****** add new things just above ---^ ******/
342
343 /* use token storage to stash these internally, not for
344 * user use */
345
346 _WSI_TOKEN_CLIENT_SENT_PROTOCOLS,
347 _WSI_TOKEN_CLIENT_PEER_ADDRESS,
348 _WSI_TOKEN_CLIENT_URI,
349 _WSI_TOKEN_CLIENT_HOST,
350 _WSI_TOKEN_CLIENT_ORIGIN,
351 _WSI_TOKEN_CLIENT_METHOD,
352 _WSI_TOKEN_CLIENT_IFACE,
353 _WSI_TOKEN_CLIENT_ALPN,
354
355 /* always last real token index*/
356 WSI_TOKEN_COUNT,
357
358 /* parser state additions, no storage associated */
359 WSI_TOKEN_NAME_PART,
360#if defined(LWS_WITH_CUSTOM_HEADERS) || defined(LWS_HTTP_HEADERS_ALL)
361 WSI_TOKEN_UNKNOWN_VALUE_PART,
362#endif
363 WSI_TOKEN_SKIPPING,
364 WSI_TOKEN_SKIPPING_SAW_CR,
365 WSI_PARSING_COMPLETE,
366 WSI_INIT_TOKEN_MUXURL,
367};
368
370 unsigned short token_limit[WSI_TOKEN_COUNT];
371};
372
373enum lws_h2_settings {
374 H2SET_HEADER_TABLE_SIZE = 1,
375 H2SET_ENABLE_PUSH,
376 H2SET_MAX_CONCURRENT_STREAMS,
377 H2SET_INITIAL_WINDOW_SIZE,
378 H2SET_MAX_FRAME_SIZE,
379 H2SET_MAX_HEADER_LIST_SIZE,
380 H2SET_RESERVED7,
381 H2SET_ENABLE_CONNECT_PROTOCOL, /* defined in mcmanus-httpbis-h2-ws-02 */
382
383 H2SET_COUNT /* always last */
384};
385
391LWS_VISIBLE LWS_EXTERN const unsigned char *
392lws_token_to_string(enum lws_token_indexes token);
393
402LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
403lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h);
404
414LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
415lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h,
416 int frag_idx);
417
432LWS_VISIBLE LWS_EXTERN int
433lws_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h);
434
452LWS_VISIBLE LWS_EXTERN int
453lws_hdr_copy_fragment(struct lws *wsi, char *dest, int len,
454 enum lws_token_indexes h, int frag_idx);
455
472LWS_VISIBLE LWS_EXTERN int
473lws_hdr_custom_length(struct lws *wsi, const char *name, int nlen);
474
493LWS_VISIBLE LWS_EXTERN int
494lws_hdr_custom_copy(struct lws *wsi, char *dst, int len, const char *name,
495 int nlen);
496
497typedef void (*lws_hdr_custom_fe_cb_t)(const char *name, int nlen, void *opaque);
514LWS_VISIBLE LWS_EXTERN int
515lws_hdr_custom_name_foreach(struct lws *wsi, lws_hdr_custom_fe_cb_t cb, void *opaque);
516
538LWS_VISIBLE LWS_EXTERN int
539lws_get_urlarg_by_name_safe(struct lws *wsi, const char *name, char *buf, int len);
540
558LWS_VISIBLE LWS_EXTERN const char *
559lws_get_urlarg_by_name(struct lws *wsi, const char *name, char *buf, int len)
560/* LWS_WARN_DEPRECATED */;
562
578
579#define LWSAHH_CODE_MASK ((1 << 16) - 1)
580#define LWSAHH_FLAG_NO_SERVER_NAME (1 << 30)
581
596LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
598 unsigned int code, unsigned char **p,
599 unsigned char *end);
612LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
613lws_add_http_header_by_name(struct lws *wsi, const unsigned char *name,
614 const unsigned char *value, int length,
615 unsigned char **p, unsigned char *end);
629LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
630lws_add_http_header_by_token(struct lws *wsi, enum lws_token_indexes token,
631 const unsigned char *value, int length,
632 unsigned char **p, unsigned char *end);
643LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
645 lws_filepos_t content_length,
646 unsigned char **p, unsigned char *end);
656LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
657lws_finalize_http_header(struct lws *wsi, unsigned char **p,
658 unsigned char *end);
659
671LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
672lws_finalize_write_http_header(struct lws *wsi, unsigned char *start,
673 unsigned char **p, unsigned char *end);
674
675#define LWS_ILLEGAL_HTTP_CONTENT_LEN ((lws_filepos_t)-1ll)
676
703LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
704lws_add_http_common_headers(struct lws *wsi, unsigned int code,
705 const char *content_type, lws_filepos_t content_len,
706 unsigned char **p, unsigned char *end);
707
708enum {
709 LWSHUMETH_GET,
710 LWSHUMETH_POST,
711 LWSHUMETH_OPTIONS,
712 LWSHUMETH_PUT,
713 LWSHUMETH_PATCH,
714 LWSHUMETH_DELETE,
715 LWSHUMETH_CONNECT,
716 LWSHUMETH_HEAD,
717 LWSHUMETH_COLON_PATH,
718};
719
732
733LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
734lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len);
735
737
748
759LWS_VISIBLE LWS_EXTERN const char *
760lws_urlencode(char *escaped, const char *string, int len);
761
762/*
763 * URLDECODE 1 / 2
764 *
765 * This simple urldecode only operates until the first '\0' and requires the
766 * data to exist all at once
767 */
783LWS_VISIBLE LWS_EXTERN int
784lws_urldecode(char *string, const char *escaped, int len);
786
797LWS_VISIBLE LWS_EXTERN int
798lws_http_date_render_from_unix(char *buf, size_t len, const time_t *t);
799
810LWS_VISIBLE LWS_EXTERN int
811lws_http_date_parse_unix(const char *b, size_t len, time_t *t);
812
831LWS_VISIBLE LWS_EXTERN int
832lws_http_check_retry_after(struct lws *wsi, lws_usec_t *us_interval_in_out);
833
843LWS_VISIBLE LWS_EXTERN int
844lws_return_http_status(struct lws *wsi, unsigned int code,
845 const char *html_body);
846
859LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
860lws_http_redirect(struct lws *wsi, int code, const unsigned char *loc, int len,
861 unsigned char **p, unsigned char *end);
862
871LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT
872lws_http_transaction_completed(struct lws *wsi);
873
881LWS_VISIBLE LWS_EXTERN int
882lws_http_headers_detach(struct lws *wsi);
883
892LWS_VISIBLE LWS_EXTERN int
893lws_http_mark_sse(struct lws *wsi);
894
910LWS_VISIBLE LWS_EXTERN int
911lws_h2_client_stream_long_poll_rxonly(struct lws *wsi);
912
938LWS_VISIBLE LWS_EXTERN int
939lws_http_compression_apply(struct lws *wsi, const char *name,
940 unsigned char **p, unsigned char *end, char decomp);
941
950LWS_VISIBLE LWS_EXTERN int
951lws_http_is_redirected_to_get(struct lws *wsi);
952
970LWS_VISIBLE LWS_EXTERN int
971lws_http_cookie_get(struct lws *wsi, const char *name, char *buf, size_t *max);
972
981#define lws_http_client_http_resp_is_error(code) (!(code < 400))
982
1008#define LWS_H2_STREAM_SID -1
1009LWS_VISIBLE LWS_EXTERN int
1010lws_h2_update_peer_txcredit(struct lws *wsi, unsigned int sid, int bump);
1011
1012
1024LWS_VISIBLE LWS_EXTERN int
1025lws_h2_get_peer_txcredit_estimate(struct lws *wsi);
1026
1028
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)
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_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)
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_hdr_copy(struct lws *wsi, char *dest, int len, enum lws_token_indexes h)
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_hdr_copy_fragment(struct lws *wsi, char *dest, int len, enum lws_token_indexes h, int frag_idx)
LWS_VISIBLE LWS_EXTERN const unsigned char * lws_token_to_string(enum lws_token_indexes token)
Definition lws-context-vhost.h:1293
Definition lws-http.h:132
int chunked
Definition lws-http.h:137
char * p
Definition lws-http.h:133
int len
Definition lws-http.h:134
int max_len
Definition lws-http.h:135
Definition lws-http.h:143
const char *const * vars
Definition lws-http.h:148
int pos
Definition lws-http.h:146
lws_process_html_state_cb replace
Definition lws-http.h:151
char swallow[16]
Definition lws-http.h:145
int count_vars
Definition lws-http.h:149
char * start
Definition lws-http.h:144
void * data
Definition lws-http.h:147
Definition lws-http.h:369
unsigned short token_limit[WSI_TOKEN_COUNT]
Definition lws-http.h:370
Definition lws-http.h:204
int len
Definition lws-http.h:206
unsigned char * token
Definition lws-http.h:205