22 #ifndef CROW_http_parser_h 23 #define CROW_http_parser_h 29 #define CROW_HTTP_PARSER_VERSION_MAJOR 2 30 #define CROW_HTTP_PARSER_VERSION_MINOR 3 31 #define CROW_HTTP_PARSER_VERSION_PATCH 0 33 #include <sys/types.h> 34 #if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600) 37 typedef __int8 int8_t;
38 typedef unsigned __int8 uint8_t;
39 typedef __int16 int16_t;
40 typedef unsigned __int16 uint16_t;
41 typedef __int32 int32_t;
42 typedef unsigned __int32 uint32_t;
43 typedef __int64 int64_t;
44 typedef unsigned __int64 uint64_t;
52 #ifndef CROW_HTTP_PARSER_STRICT 53 # define CROW_HTTP_PARSER_STRICT 1 63 #ifndef CROW_HTTP_MAX_HEADER_SIZE 64 # define CROW_HTTP_MAX_HEADER_SIZE (80*1024) 89 #define CROW_HTTP_METHOD_MAP(CROW_XX) \ 90 CROW_XX(0, DELETE, DELETE) \ 91 CROW_XX(1, GET, GET) \ 92 CROW_XX(2, HEAD, HEAD) \ 93 CROW_XX(3, POST, POST) \ 94 CROW_XX(4, PUT, PUT) \ 96 CROW_XX(5, CONNECT, CONNECT) \ 97 CROW_XX(6, OPTIONS, OPTIONS) \ 98 CROW_XX(7, TRACE, TRACE) \ 100 CROW_XX(8, COPY, COPY) \ 101 CROW_XX(9, LOCK, LOCK) \ 102 CROW_XX(10, MKCOL, MKCOL) \ 103 CROW_XX(11, MOVE, MOVE) \ 104 CROW_XX(12, PROPFIND, PROPFIND) \ 105 CROW_XX(13, PROPPATCH, PROPPATCH) \ 106 CROW_XX(14, SEARCH, SEARCH) \ 107 CROW_XX(15, UNLOCK, UNLOCK) \ 109 CROW_XX(16, REPORT, REPORT) \ 110 CROW_XX(17, MKACTIVITY, MKACTIVITY) \ 111 CROW_XX(18, CHECKOUT, CHECKOUT) \ 112 CROW_XX(19, MERGE, MERGE) \ 114 CROW_XX(20, MSEARCH, M-SEARCH) \ 115 CROW_XX(21, NOTIFY, NOTIFY) \ 116 CROW_XX(22, SUBSCRIBE, SUBSCRIBE) \ 117 CROW_XX(23, UNSUBSCRIBE, UNSUBSCRIBE) \ 119 CROW_XX(24, PATCH, PATCH) \ 120 CROW_XX(25, PURGE, PURGE) \ 122 CROW_XX(26, MKCALENDAR, MKCALENDAR) \ 126 #define CROW_XX(num, name, string) HTTP_##name = num, 150 #define CROW_HTTP_ERRNO_MAP(CROW_XX) \ 152 CROW_XX(OK, "success") \ 155 CROW_XX(CB_message_begin, "the on_message_begin callback failed") \ 156 CROW_XX(CB_url, "the on_url callback failed") \ 157 CROW_XX(CB_header_field, "the on_header_field callback failed") \ 158 CROW_XX(CB_header_value, "the on_header_value callback failed") \ 159 CROW_XX(CB_headers_complete, "the on_headers_complete callback failed") \ 160 CROW_XX(CB_body, "the on_body callback failed") \ 161 CROW_XX(CB_message_complete, "the on_message_complete callback failed") \ 162 CROW_XX(CB_status, "the on_status callback failed") \ 165 CROW_XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \ 166 CROW_XX(HEADER_OVERFLOW, \ 167 "too many header bytes seen; overflow detected") \ 168 CROW_XX(CLOSED_CONNECTION, \ 169 "data received after completed connection: close message") \ 170 CROW_XX(INVALID_VERSION, "invalid HTTP version") \ 171 CROW_XX(INVALID_STATUS, "invalid HTTP status code") \ 172 CROW_XX(INVALID_METHOD, "invalid HTTP method") \ 173 CROW_XX(INVALID_URL, "invalid URL") \ 174 CROW_XX(INVALID_HOST, "invalid host") \ 175 CROW_XX(INVALID_PORT, "invalid port") \ 176 CROW_XX(INVALID_PATH, "invalid path") \ 177 CROW_XX(INVALID_QUERY_STRING, "invalid query string") \ 178 CROW_XX(INVALID_FRAGMENT, "invalid fragment") \ 179 CROW_XX(LF_EXPECTED, "CROW_LF character expected") \ 180 CROW_XX(INVALID_HEADER_TOKEN, "invalid character in header") \ 181 CROW_XX(INVALID_CONTENT_LENGTH, \ 182 "invalid character in content-length header") \ 183 CROW_XX(INVALID_CHUNK_SIZE, \ 184 "invalid character in chunk size header") \ 185 CROW_XX(INVALID_CONSTANT, "invalid constant string") \ 186 CROW_XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ 187 CROW_XX(STRICT, "strict mode assertion failed") \ 188 CROW_XX(PAUSED, "parser is paused") \ 189 CROW_XX(UNKNOWN, "an unknown error occurred") 193 #define CROW_HTTP_ERRNO_GEN(n, s) HPE_##n, 197 #undef CROW_HTTP_ERRNO_GEN 201 #define CROW_HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno) 356 #ifndef CROW_ULLONG_MAX 357 # define CROW_ULLONG_MAX ((uint64_t) -1) 361 # define CROW_MIN(a,b) ((a) < (b) ? (a) : (b)) 364 #ifndef CROW_ARRAY_SIZE 365 # define CROW_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 369 # define CROW_BIT_AT(a, i) \ 370 (!!((unsigned int) (a)[(unsigned int) (i) >> 3] & \ 371 (1 << ((unsigned int) (i) & 7)))) 375 # define CROW_ELEM_AT(a, i, v) ((unsigned int) (i) < CROW_ARRAY_SIZE(a) ? (a)[(i)] : (v)) 378 #define CROW_SET_ERRNO(e) \ 380 parser->http_errno = (e); \ 385 #define CROW_CALLBACK_NOTIFY_(FOR, ER) \ 387 assert(CROW_HTTP_PARSER_ERRNO(parser) == HPE_OK); \ 389 if (settings->on_##FOR) { \ 390 if (0 != settings->on_##FOR(parser)) { \ 391 CROW_SET_ERRNO(HPE_CB_##FOR); \ 395 if (CROW_HTTP_PARSER_ERRNO(parser) != HPE_OK) { \ 402 #define CROW_CALLBACK_NOTIFY(FOR) CROW_CALLBACK_NOTIFY_(FOR, p - data + 1) 405 #define CROW_CALLBACK_NOTIFY_NOADVANCE(FOR) CROW_CALLBACK_NOTIFY_(FOR, p - data) 408 #define CROW_CALLBACK_DATA_(FOR, LEN, ER) \ 410 assert(CROW_HTTP_PARSER_ERRNO(parser) == HPE_OK); \ 413 if (settings->on_##FOR) { \ 414 if (0 != settings->on_##FOR(parser, FOR##_mark, (LEN))) { \ 415 CROW_SET_ERRNO(HPE_CB_##FOR); \ 419 if (CROW_HTTP_PARSER_ERRNO(parser) != HPE_OK) { \ 428 #define CROW_CALLBACK_DATA(FOR) \ 429 CROW_CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1) 432 #define CROW_CALLBACK_DATA_NOADVANCE(FOR) \ 433 CROW_CALLBACK_DATA_(FOR, p - FOR##_mark, p - data) 436 #define CROW_MARK(FOR) \ 444 #define CROW_PROXY_CONNECTION "proxy-connection" 445 #define CROW_CONNECTION "connection" 446 #define CROW_CONTENT_LENGTH "content-length" 447 #define CROW_TRANSFER_ENCODING "transfer-encoding" 448 #define CROW_UPGRADE "upgrade" 449 #define CROW_CHUNKED "chunked" 450 #define CROW_KEEP_ALIVE "keep-alive" 451 #define CROW_CLOSE "close" 537 #define CROW_PARSING_HEADER(state) (state <= s_headers_done) 583 #define CROW_LOWER(c) (unsigned char)(c | 0x20) 584 #define CROW_IS_ALPHA(c) (CROW_LOWER(c) >= 'a' && CROW_LOWER(c) <= 'z') 585 #define CROW_IS_NUM(c) ((c) >= '0' && (c) <= '9') 586 #define CROW_IS_ALPHANUM(c) (CROW_IS_ALPHA(c) || CROW_IS_NUM(c)) 587 #define CROW_IS_HEX(c) (CROW_IS_NUM(c) || (CROW_LOWER(c) >= 'a' && CROW_LOWER(c) <= 'f')) 588 #define CROW_IS_MARK(c) ((c) == '-' || (c) == '_' || (c) == '.' || \ 589 (c) == '!' || (c) == '~' || (c) == '*' || (c) == '\'' || (c) == '(' || \ 591 #define CROW_IS_USERINFO_CHAR(c) (CROW_IS_ALPHANUM(c) || CROW_IS_MARK(c) || (c) == '%' || \ 592 (c) == ';' || (c) == ':' || (c) == '&' || (c) == '=' || (c) == '+' || \ 593 (c) == '$' || (c) == ',') 595 #if CROW_HTTP_PARSER_STRICT 596 #define CROW_TOKEN(c) (tokens[(unsigned char)c]) 597 #define CROW_IS_URL_CHAR(c) (CROW_BIT_AT(normal_url_char, (unsigned char)c)) 598 #define CROW_IS_HOST_CHAR(c) (CROW_IS_ALPHANUM(c) || (c) == '.' || (c) == '-') 600 #define CROW_TOKEN(c) ((c == ' ') ? ' ' : tokens[(unsigned char)c]) 601 #define CROW_IS_URL_CHAR(c) \ 602 (CROW_BIT_AT(normal_url_char, (unsigned char)c) || ((c) & 0x80)) 603 #define CROW_IS_HOST_CHAR(c) \ 604 (CROW_IS_ALPHANUM(c) || (c) == '.' || (c) == '-' || (c) == '_') 608 #define CROW_start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res) 611 #if CROW_HTTP_PARSER_STRICT 612 # define CROW_STRICT_CHECK(cond) \ 615 CROW_SET_ERRNO(HPE_STRICT); \ 619 # define CROW_NEW_MESSAGE() (http_should_keep_alive(parser) ? CROW_start_state : s_dead) 621 # define CROW_STRICT_CHECK(cond) 622 # define CROW_NEW_MESSAGE() CROW_start_state 643 #if CROW_HTTP_PARSER_STRICT 650 static const uint8_t normal_url_char[32] = {
652 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
656 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
658 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0,
660 0 | 2 | 4 | 0 | 16 | 32 | 64 | 128,
662 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
664 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
666 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0,
668 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
670 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
672 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
674 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
676 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
678 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
680 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
682 1 | 2 | 4 | 8 | 16 | 32 | 64 | 0, };
686 if (ch ==
' ' || ch ==
'\r' || ch ==
'\n') {
690 #if CROW_HTTP_PARSER_STRICT 691 if (ch ==
'\t' || ch ==
'\f') {
702 if (ch ==
'/' || ch ==
'*') {
836 static const char *method_strings[] =
838 #define CROW_XX(num, name, string) #string, 850 static const char tokens[256] = {
852 0, 0, 0, 0, 0, 0, 0, 0,
854 0, 0, 0, 0, 0, 0, 0, 0,
856 0, 0, 0, 0, 0, 0, 0, 0,
858 0, 0, 0, 0, 0, 0, 0, 0,
860 0,
'!', 0,
'#',
'$',
'%',
'&',
'\'',
862 0, 0,
'*',
'+', 0,
'-',
'.', 0,
864 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
866 '8',
'9', 0, 0, 0, 0, 0, 0,
868 0,
'a',
'b',
'c',
'd',
'e',
'f',
'g',
870 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
872 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
874 'x',
'y',
'z', 0, 0, 0,
'^',
'_',
876 '`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
878 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
880 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
882 'x',
'y',
'z', 0,
'|', 0,
'~', 0 };
885 static const int8_t unhex[256] =
886 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
887 ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
888 ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
889 , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1
890 ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
891 ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
892 ,-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1
893 ,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
900 const char *p = data;
901 const char *header_field_mark = 0;
902 const char *header_value_mark = 0;
903 const char *url_mark = 0;
904 const char *body_mark = 0;
905 const char *status_mark = 0;
913 switch (parser->
state) {
935 header_field_mark = data;
937 header_value_mark = data;
938 switch (parser->
state) {
957 for (p=data; p != data + len; p++) {
980 switch (parser->
state) {
1006 goto reexecute_byte;
1023 parser->
method = HTTP_HEAD;
1073 if (ch < '0' || ch >
'9') {
1240 case 'C': parser->
method = HTTP_CONNECT;
break;
1241 case 'D': parser->
method = HTTP_DELETE;
break;
1242 case 'G': parser->
method = HTTP_GET;
break;
1243 case 'H': parser->
method = HTTP_HEAD;
break;
1244 case 'L': parser->
method = HTTP_LOCK;
break;
1245 case 'M': parser->
method = HTTP_MKCOL;
break;
1246 case 'N': parser->
method = HTTP_NOTIFY;
break;
1247 case 'O': parser->
method = HTTP_OPTIONS;
break;
1248 case 'P': parser->
method = HTTP_POST;
1251 case 'R': parser->
method = HTTP_REPORT;
break;
1252 case 'S': parser->
method = HTTP_SUBSCRIBE;
break;
1253 case 'T': parser->
method = HTTP_TRACE;
break;
1254 case 'U': parser->
method = HTTP_UNLOCK;
break;
1268 const char *matcher;
1274 matcher = method_strings[parser->
method];
1275 if (ch ==
' ' && matcher[parser->
index] ==
'\0') {
1277 }
else if (ch == matcher[parser->
index]) {
1279 }
else if (parser->
method == HTTP_CONNECT) {
1280 if (parser->
index == 1 && ch ==
'H') {
1281 parser->
method = HTTP_CHECKOUT;
1282 }
else if (parser->
index == 2 && ch ==
'P') {
1283 parser->
method = HTTP_COPY;
1288 }
else if (parser->
method == HTTP_MKCOL) {
1289 if (parser->
index == 1 && ch ==
'O') {
1290 parser->
method = HTTP_MOVE;
1291 }
else if (parser->
index == 1 && ch ==
'E') {
1292 parser->
method = HTTP_MERGE;
1293 }
else if (parser->
index == 1 && ch ==
'-') {
1294 parser->
method = HTTP_MSEARCH;
1295 }
else if (parser->
index == 2 && ch ==
'A') {
1296 parser->
method = HTTP_MKACTIVITY;
1297 }
else if (parser->
index == 3 && ch ==
'A') {
1298 parser->
method = HTTP_MKCALENDAR;
1303 }
else if (parser->
method == HTTP_SUBSCRIBE) {
1304 if (parser->
index == 1 && ch ==
'E') {
1305 parser->
method = HTTP_SEARCH;
1310 }
else if (parser->
index == 1 && parser->
method == HTTP_POST) {
1312 parser->
method = HTTP_PROPFIND;
1313 }
else if (ch ==
'U') {
1314 parser->
method = HTTP_PUT;
1315 }
else if (ch ==
'A') {
1316 parser->
method = HTTP_PATCH;
1321 }
else if (parser->
index == 2) {
1322 if (parser->
method == HTTP_PUT) {
1324 parser->
method = HTTP_PURGE;
1329 }
else if (parser->
method == HTTP_UNLOCK) {
1331 parser->
method = HTTP_UNSUBSCRIBE;
1340 }
else if (parser->
index == 4 && parser->
method == HTTP_PROPFIND && ch ==
'P') {
1341 parser->
method = HTTP_PROPPATCH;
1353 if (ch ==
' ')
break;
1356 if (parser->
method == HTTP_CONNECT) {
1459 if (ch < '1' || ch >
'9') {
1557 goto reexecute_byte;
1698 assert(0 &&
"Unknown header_state");
1727 if (ch ==
' ' || ch ==
'\t')
break;
1779 }
else if (c ==
'c') {
1805 goto reexecute_byte;
1816 assert(0 &&
"Shouldn't get here.");
1823 if (ch ==
' ')
break;
1900 if (ch ==
' ' || ch ==
'\t') {
1902 goto reexecute_byte;
1921 goto reexecute_byte;
1933 if (ch ==
' ' || ch ==
'\t') {
1941 goto reexecute_byte;
1990 goto reexecute_byte;
2003 return (p - data) + 1;
2039 (uint64_t) ((data + len) - p));
2066 goto reexecute_byte;
2086 assert(parser->
nread == 1);
2089 unhex_val = unhex[(
unsigned char)ch];
2090 if (unhex_val == -1) {
2111 unhex_val = unhex[(
unsigned char)ch];
2113 if (unhex_val == -1) {
2114 if (ch ==
';' || ch ==
' ') {
2167 (uint64_t) ((data + len) - p));
2203 assert(0 &&
"unhandled state");
2219 assert(((header_field_mark ? 1 : 0) +
2220 (header_value_mark ? 1 : 0) +
2221 (url_mark ? 1 : 0) +
2222 (body_mark ? 1 : 0) +
2223 (status_mark ? 1 : 0)) <= 1);
2288 static const char *method_strings[] =
2290 #define CROW_XX(num, name, string) #string, 2301 void *data = parser->
data;
2302 memset(parser, 0,
sizeof(*parser));
2303 parser->
data = data;
2312 #define CROW_HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s }, 2315 const char *description;
2316 } http_strerror_tab[] = {
2319 #undef CROW_HTTP_STRERROR_GEN 2320 assert(err < (
sizeof(http_strerror_tab)/
sizeof(http_strerror_tab[0])));
2321 return http_strerror_tab[err].name;
2327 #define CROW_HTTP_STRERROR_GEN(n, s) { "HPE_" #n, s }, 2330 const char *description;
2331 } http_strerror_tab[] = {
2334 #undef CROW_HTTP_STRERROR_GEN 2335 assert(err < (
sizeof(http_strerror_tab)/
sizeof(http_strerror_tab[0])));
2336 return http_strerror_tab[err].description;
2490 for (p = buf; p < buf + buflen; p++) {
2531 assert(!
"Unexpected state");
2570 u->
port = (uint16_t) v;
2586 assert(0 &&
"Attempting to pause parser in error state");
2595 inline unsigned long 2602 #undef CROW_HTTP_METHOD_MAP 2603 #undef CROW_HTTP_ERRNO_MAP 2604 #undef CROW_SET_ERRNO 2605 #undef CROW_CALLBACK_NOTIFY_ 2606 #undef CROW_CALLBACK_NOTIFY 2607 #undef CROW_CALLBACK_NOTIFY_NOADVANCE 2608 #undef CROW_CALLBACK_DATA_ 2609 #undef CROW_CALLBACK_DATA 2610 #undef CROW_CALLBACK_DATA_NOADVANCE 2612 #undef CROW_PROXY_CONNECTION 2613 #undef CROW_CONNECTION 2614 #undef CROW_CONTENT_LENGTH 2615 #undef CROW_TRANSFER_ENCODING 2618 #undef CROW_KEEP_ALIVE 2620 #undef CROW_PARSING_HEADER 2624 #undef CROW_IS_ALPHA 2626 #undef CROW_IS_ALPHANUM 2629 #undef CROW_IS_USERINFO_CHAR 2631 #undef CROW_IS_URL_CHAR 2632 #undef CROW_IS_HOST_CHAR 2633 #undef CROW_start_state 2634 #undef CROW_STRICT_CHECK 2635 #undef CROW_NEW_MESSAGE Definition: http_parser_merged.h:253
Definition: http_parser_merged.h:509
Definition: http_parser_merged.h:139
Definition: http_parser_merged.h:496
#define CROW_CONNECTION
Definition: http_parser_merged.h:445
Definition: http_parser_merged.h:568
Definition: http_parser_merged.h:574
uint32_t nread
Definition: http_parser_merged.h:212
Definition: http_parser_merged.h:464
Definition: http_parser_merged.h:250
int(* http_cb)(http_parser *)
Definition: http_parser_merged.h:85
Definition: http_parser_merged.h:515
Definition: http_parser_merged.h:519
http_errno
Definition: http_parser_merged.h:194
Definition: http_parser_merged.h:204
#define CROW_STRICT_CHECK(cond)
Definition: http_parser_merged.h:612
struct http_parser_url::@13 field_data[UF_MAX]
unsigned int method
Definition: http_parser_merged.h:219
#define CROW_HTTP_ERRNO_GEN(n, s)
Definition: http_parser_merged.h:193
Definition: http_parser_merged.h:553
Definition: http_parser_merged.h:252
Definition: http_parser_merged.h:248
http_data_cb on_header_field
Definition: http_parser_merged.h:238
#define CROW_HTTP_PARSER_ERRNO(p)
Definition: http_parser_merged.h:201
Definition: http_parser_merged.h:487
http_cb on_headers_complete
Definition: http_parser_merged.h:240
#define CROW_TRANSFER_ENCODING
Definition: http_parser_merged.h:447
unsigned short http_minor
Definition: http_parser_merged.h:217
Definition: http_parser_merged.h:471
http_host_state
Definition: http_parser_merged.h:566
Definition: http_parser_merged.h:465
Definition: http_parser_merged.h:478
Definition: http_parser_merged.h:506
Definition: http_parser_merged.h:493
Definition: http_parser_merged.h:505
#define CROW_IS_USERINFO_CHAR(c)
Definition: http_parser_merged.h:591
#define CROW_KEEP_ALIVE
Definition: http_parser_merged.h:450
void http_parser_pause(http_parser *parser, int paused)
Definition: http_parser_merged.h:2577
#define CROW_HTTP_PARSER_VERSION_PATCH
Definition: http_parser_merged.h:31
uint16_t len
Definition: http_parser_merged.h:271
#define CROW_CHUNKED
Definition: http_parser_merged.h:449
#define CROW_PARSING_HEADER(state)
Definition: http_parser_merged.h:537
Definition: http_parser_merged.h:459
unsigned int state
Definition: http_parser_merged.h:208
Definition: http_parser_merged.h:554
#define CROW_HTTP_MAX_HEADER_SIZE
Definition: http_parser_merged.h:64
uint16_t field_set
Definition: http_parser_merged.h:266
Definition: http_parser_merged.h:573
#define CROW_HTTP_METHOD_MAP(CROW_XX)
Definition: http_parser_merged.h:89
#define CROW_CLOSE
Definition: http_parser_merged.h:451
#define CROW_CALLBACK_NOTIFY_NOADVANCE(FOR)
Definition: http_parser_merged.h:405
Definition: http_parser_merged.h:132
Definition: http_parser_merged.h:570
Definition: http_parser_merged.h:527
#define CROW_UPGRADE
Definition: http_parser_merged.h:448
Definition: http_parser_merged.h:499
Definition: http_parser_merged.h:546
Definition: http_parser_merged.h:500
Definition: http_parser_merged.h:497
http_data_cb on_body
Definition: http_parser_merged.h:241
unsigned int status_code
Definition: http_parser_merged.h:218
Definition: http_parser_merged.h:550
const char * http_method_str(enum http_method m)
Definition: http_parser_merged.h:2286
Definition: http_parser_merged.h:503
unsigned int header_state
Definition: http_parser_merged.h:209
http_data_cb on_url
Definition: http_parser_merged.h:236
unsigned int index
Definition: http_parser_merged.h:210
flags
Definition: http_parser_merged.h:136
Definition: http_parser_merged.h:557
Definition: http_parser_merged.h:481
#define CROW_ULLONG_MAX
Definition: http_parser_merged.h:357
#define CROW_IS_URL_CHAR(c)
Definition: http_parser_merged.h:597
const char * http_errno_name(enum http_errno err)
Definition: http_parser_merged.h:2310
unsigned int flags
Definition: http_parser_merged.h:207
#define CROW_NEW_MESSAGE()
Definition: http_parser_merged.h:619
Definition: http_parser_merged.h:254
Definition: http_parser_merged.h:575
Definition: http_parser_merged.h:474
Definition: http_parser_merged.h:249
#define CROW_LF
Definition: http_parser_merged.h:582
header_states
Definition: http_parser_merged.h:540
Definition: http_parser_merged.h:467
Definition: http_parser_merged.h:142
Definition: http_parser_merged.h:547
Definition: http_parser_merged.h:491
#define CROW_HTTP_PARSER_VERSION_MINOR
Definition: http_parser_merged.h:30
Definition: http_parser_merged.h:572
Definition: http_parser_merged.h:234
Definition: http_parser_merged.h:490
Definition: http_parser_merged.h:576
#define CROW_PROXY_CONNECTION
Definition: http_parser_merged.h:444
int http_body_is_final(const http_parser *parser)
Definition: http_parser_merged.h:484
#define CROW_HTTP_PARSER_VERSION_MAJOR
Definition: http_parser_merged.h:29
int http_parser_parse_url(const char *buf, size_t buflen, int is_connect, struct http_parser_url *u)
Definition: http_parser_merged.h:2478
Definition: http_parser_merged.h:247
Definition: http_parser_merged.h:549
Definition: http_parser_merged.h:251
const char * http_errno_description(enum http_errno err)
Definition: http_parser_merged.h:2325
Definition: http_parser_merged.h:561
uint64_t content_length
Definition: http_parser_merged.h:213
int(* http_data_cb)(http_parser *, const char *at, size_t length)
Definition: http_parser_merged.h:84
http_parser_url_fields
Definition: http_parser_merged.h:246
#define CROW_HTTP_STRERROR_GEN(n, s)
http_data_cb on_status
Definition: http_parser_merged.h:237
Definition: http_parser_merged.h:472
#define CROW_CALLBACK_DATA(FOR)
Definition: http_parser_merged.h:428
Definition: http_parser_merged.h:479
Definition: http_parser_merged.h:563
#define CROW_HTTP_ERRNO_MAP(CROW_XX)
Definition: http_parser_merged.h:150
size_t http_parser_execute(http_parser *parser, const http_parser_settings *settings, const char *data, size_t len)
Definition: http_parser_merged.h:831
unsigned int http_errno
Definition: http_parser_merged.h:220
Definition: http_parser_merged.h:552
Definition: http_parser_merged.h:548
Definition: http_parser_merged.h:492
Definition: http_parser_merged.h:569
Definition: http_parser_merged.h:488
Definition: http_parser_merged.h:559
unsigned short http_major
Definition: http_parser_merged.h:216
Definition: http_parser_merged.h:513
Definition: http_parser_merged.h:480
http_method
Definition: http_parser_merged.h:124
Definition: http_parser_merged.h:508
int http_should_keep_alive(const http_parser *parser)
Definition: http_parser_merged.h:2267
#define CROW_ELEM_AT(a, i, v)
Definition: http_parser_merged.h:375
static enum http_host_state http_parse_host_char(enum http_host_state s, const char ch)
Definition: http_parser_merged.h:2340
Definition: http_parser_merged.h:132
#define CROW_CR
Definition: http_parser_merged.h:581
unsigned long http_parser_version(void)
Definition: http_parser_merged.h:2596
Definition: http_parser_merged.h:511
type
Definition: json.h:74
#define CROW_IS_HOST_CHAR(c)
Definition: http_parser_merged.h:598
#define CROW_SET_ERRNO(e)
Definition: http_parser_merged.h:378
Definition: http_parser_merged.h:577
Definition: http_parser_merged.h:469
#define CROW_LOWER(c)
Definition: http_parser_merged.h:583
Definition: http_parser_merged.h:541
Definition: http_parser_merged.h:468
Definition: http_parser_merged.h:543
http_data_cb on_header_value
Definition: http_parser_merged.h:239
Definition: http_parser_merged.h:495
Definition: http_parser_merged.h:504
Definition: http_parser_merged.h:476
#define CROW_MIN(a, b)
Definition: http_parser_merged.h:361
int http_message_needs_eof(const http_parser *parser)
Definition: http_parser_merged.h:2244
Definition: http_parser_merged.h:463
Definition: blake256.h:37
Definition: http_parser_merged.h:138
enum state parse_url_char(enum state s, const char ch)
Definition: http_parser_merged.h:641
Definition: http_parser_merged.h:533
#define CROW_TOKEN(c)
Definition: http_parser_merged.h:596
Definition: http_parser_merged.h:571
void * data
Definition: http_parser_merged.h:230
Definition: http_parser_merged.h:502
Definition: http_parser_merged.h:542
#define CROW_XX(num, name, string)
Definition: http_parser_merged.h:126
Definition: http_parser_merged.h:470
Definition: http_parser_merged.h:473
Definition: http_parser_merged.h:486
Definition: http_parser_merged.h:132
uint16_t off
Definition: http_parser_merged.h:270
Definition: http_parser_merged.h:462
#define CROW_IS_ALPHA(c)
Definition: http_parser_merged.h:584
Definition: http_parser_merged.h:558
Definition: http_parser_merged.h:516
#define CROW_MARK(FOR)
Definition: http_parser_merged.h:436
void http_parser_init(http_parser *parser, enum http_parser_type type)
Definition: http_parser_merged.h:2299
unsigned int upgrade
Definition: http_parser_merged.h:227
Definition: http_parser_merged.h:526
Definition: http_parser_merged.h:489
#define CROW_CONTENT_LENGTH
Definition: http_parser_merged.h:446
Definition: http_parser_merged.h:544
Definition: http_parser_merged.h:518
Definition: http_parser_merged.h:514
Definition: http_parser_merged.h:140
http_cb on_message_begin
Definition: http_parser_merged.h:235
#define CROW_CALLBACK_NOTIFY(FOR)
Definition: http_parser_merged.h:402
const char * name
Definition: simplewallet.cpp:180
Definition: http_parser_merged.h:494
uint16_t port
Definition: http_parser_merged.h:267
Definition: http_parser_merged.h:507
Definition: http_parser_merged.h:531
Definition: http_parser_merged.h:498
Definition: http_parser_merged.h:485
Definition: http_parser_merged.h:528
Definition: http_parser_merged.h:483
Definition: http_parser_merged.h:562
Definition: http_parser_merged.h:461
int http_parse_host(const char *buf, struct http_parser_url *u, int found_at)
Definition: http_parser_merged.h:2405
Definition: http_parser_merged.h:482
unsigned int type
Definition: http_parser_merged.h:206
#define CROW_CALLBACK_DATA_NOADVANCE(FOR)
Definition: http_parser_merged.h:432
Definition: http_parser_merged.h:137
#define s(x, c)
Definition: aesb.c:46
http_parser_type
Definition: http_parser_merged.h:132
http_cb on_message_complete
Definition: http_parser_merged.h:242
Definition: http_parser_merged.h:265
Definition: http_parser_merged.h:457
#define CROW_IS_NUM(c)
Definition: http_parser_merged.h:585
#define CROW_IS_HEX(c)
Definition: http_parser_merged.h:587
Definition: http_parser_merged.h:466
Definition: http_parser_merged.h:141
Definition: http_parser_merged.h:460
Definition: http_parser_merged.h:530
#define CROW_CALLBACK_DATA_(FOR, LEN, ER)
Definition: http_parser_merged.h:408
Definition: http_parser_merged.h:555