constrained, so you only need to take care about them if you want to tune them
to the amount of memory available.
- - LWS_MAX_HEADER_NAME_LENGTH default 64: max characters in an HTTP header
-name that libwebsockets can cope with, if a header arrives bigger than this
-it's ignored until the next header is seen
-
- LWS_MAX_HEADER_LEN default 1024: allocated area to copy http headers that
libwebsockets knows about into. You only need to think about increasing this
if your application might have monster length URLs for example, or some other
case WSI_TOKEN_NAME_PART:
lwsl_parser("WSI_TOKEN_NAME_PART '%c'\n", c);
- if (wsi->u.hdr.name_buffer_pos ==
- sizeof(wsi->u.hdr.name_buffer) - 1) {
- /* did we see HTTP token yet? */
- if (!wsi->u.hdr.ah->frag_index[WSI_TOKEN_GET_URI]) {
- lwsl_info("junk before method\n");
- return -1;
- }
- /* name bigger than we can handle, skip until next */
- wsi->u.hdr.name_buffer_pos = 0;
- wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
- break;
- }
- wsi->u.hdr.name_buffer[wsi->u.hdr.name_buffer_pos++] = c;
- wsi->u.hdr.name_buffer[wsi->u.hdr.name_buffer_pos] = '\0';
-
wsi->u.hdr.lextable_pos =
lextable_decode(wsi->u.hdr.lextable_pos, c);
n = lextable[wsi->u.hdr.lextable_pos] & 0x7f;
- lwsl_parser("known hdr '%s'\n", wsi->u.hdr.name_buffer);
+ lwsl_parser("known hdr %d\n", n);
if (n == WSI_TOKEN_GET_URI &&
wsi->u.hdr.ah->frag_index[WSI_TOKEN_GET_URI]) {
wsi->u.hdr.lextable_pos = 0;
} else
wsi->u.hdr.parser_state = WSI_TOKEN_SKIPPING;
- wsi->u.hdr.name_buffer_pos = 0;
break;
/* we're done, ignore anything else */
case WSI_PARSING_COMPLETE:
};
struct _lws_header_related {
- char name_buffer[LWS_MAX_HEADER_NAME_LENGTH];
- unsigned char name_buffer_pos;
struct allocated_headers *ah;
int lextable_pos;
unsigned char parser_state; /* enum lws_token_indexes */
/* intialize the instance struct */
new_wsi->state = WSI_STATE_HTTP;
- new_wsi->u.hdr.name_buffer_pos = 0;
new_wsi->mode = LWS_CONNMODE_HTTP_SERVING;
new_wsi->hdr_parsing_completed = 0;