add lexical parser for headers
authorAndy Green <andy.green@linaro.org>
Thu, 17 Jan 2013 17:55:48 +0000 (01:55 +0800)
committerAndy Green <andy.green@linaro.org>
Thu, 17 Jan 2013 17:55:48 +0000 (01:55 +0800)
commit6d1fcb7a95390715b1eceb8fb54b0db033693be0
treea9a4f1a6f021478c1d36c4f18efa3f87f0fde272
parent4a673a38cadd452318609b81dc1270d8cdb6b6de
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