#include <stdlib.h>
#include <string.h>
-/* set of parsable strings -- ALL LOWER CASE */
-
-const char *set[] = {
- "get ",
- "post ",
- "options ",
- "host:",
- "connection:",
- "upgrade:",
- "origin:",
- "sec-websocket-draft:",
- "\x0d\x0a",
-
- "sec-websocket-extensions:",
- "sec-websocket-key1:",
- "sec-websocket-key2:",
- "sec-websocket-protocol:",
-
- "sec-websocket-accept:",
- "sec-websocket-nonce:",
- "http/1.1 ",
- "http2-settings:",
-
- "accept:",
- "access-control-request-headers:",
- "if-modified-since:",
- "if-none-match:",
- "accept-encoding:",
- "accept-language:",
- "pragma:",
- "cache-control:",
- "authorization:",
- "cookie:",
- "content-length:",
- "content-type:",
- "date:",
- "range:",
- "referer:",
- "sec-websocket-key:",
- "sec-websocket-version:",
- "sec-websocket-origin:",
-
- ":authority:",
- ":method:",
- ":path:",
- ":scheme:",
- ":status:",
-
- "accept-charset:",
- "accept-ranges:",
- "access-control-allow-origin:",
- "age:",
- "allow:",
- "content-disposition:",
- "content-language:",
- "content-location:",
- "content-range:",
- "etag:",
- "expect:",
- "expires:",
- "from:",
- "if-match:",
- "if-range:",
- "if-unmodified-since:",
- "last-modified:",
- "link:",
- "location:",
- "max-forwards:",
- "proxy-authenticate:",
- "proxy-authorization:",
- "refresh:",
- "retry-after:",
- "server:",
- "set-cookie:",
- "strict-transport-security:",
- "transfer-encoding:",
- "user-agent:",
- "vary:",
- "via:",
- "www-authenticate:",
-
- "", /* not matchable */
-
-};
+#include "lextable-strings.h"
/*
* b7 = 0 = 1-byte seq
* 0x08 = fail
* 2-byte seq
- * 0x00 - 0x07, then terminal as given in 2nd byte
+ * 0x00 - 0x07, then terminal as given in 2nd byte
3-byte seq
- * no match: go fwd 3 byte, match: jump fwd by amt in +1/+2 bytes
+ * no match: go fwd 3 byte, match: jump fwd by amt in +1/+2 bytes
* = 1 = 1-byte seq
- * no match: die, match go fwd 1 byte
+ * no match: die, match go fwd 1 byte
*/
unsigned char lextable[] = {
int lextable_decode(int pos, char c)
{
-
while (1) {
if (lextable[pos] & (1 << 7)) { /* 1-byte, fail on mismatch */
if ((lextable[pos] & 0x7f) != c)