add lexical parser for headers 31/2931/1
authorAndy Green <andy.green@linaro.org>
Thu, 17 Jan 2013 17:55:48 +0000 (01:55 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:26 +0000 (13:01 -0800)
commit53a8fa91d22cf19b2a70a34f0c55556d8d30b56a
tree79c49fc2b7262ad0167df5a4c69136e0d111cd60
parent746375721d342d949698092d324350ef4d1ec001
add lexical parser for headers

Profiling what happens during the ab test, one of the hotspots
was strcasecmp in a loop looking for header name matches each time.

This patch introduces a lexical parser that creates a state machine
in 276 bytes that encodes all the known header names.  The fsm is
walked bytewise as chaacters come in... most states do not need any
recursion to match or fail.

The state machine output is cut-and-pasted into parsers.c as an
unsigned char array.

The fsm generator is a bit rough and ready, included in the tree but
not built since normal mortals won't need to touch it.

Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client.c
lib/handshake.c
lib/minilex.c [new file with mode: 0644]
lib/parsers.c
lib/private-libwebsockets.h