diff --git a/ext/puma_http11/http11_parser.c b/ext/puma_http11/http11_parser.c index 3398b7bab4..864ad04539 100644 --- a/ext/puma_http11/http11_parser.c +++ b/ext/puma_http11/http11_parser.c @@ -31,27 +31,27 @@ static void snake_upcase_char(char *c) /** Machine **/ -#line 78 "ext/puma_http11/http11_parser.rl" +#line 79 "ext/puma_http11/http11_parser.rl" /** Data **/ -#line 39 "ext/puma_http11/http11_parser.c" +#line 40 "ext/puma_http11/http11_parser.c" static const int puma_parser_start = 1; static const int puma_parser_first_final = 47; static const int puma_parser_error = 0; -#line 82 "ext/puma_http11/http11_parser.rl" +#line 83 "ext/puma_http11/http11_parser.rl" int puma_parser_init(puma_parser *parser) { int cs = 0; -#line 52 "ext/puma_http11/http11_parser.c" +#line 53 "ext/puma_http11/http11_parser.c" { cs = puma_parser_start; } -#line 86 "ext/puma_http11/http11_parser.rl" +#line 87 "ext/puma_http11/http11_parser.rl" parser->cs = cs; parser->body_start = 0; parser->content_len = 0; @@ -77,10 +77,10 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len, pe = buffer+len; /* assert(*pe == '\0' && "pointer does not end on NUL"); */ - assert(pe - p == len - off && "pointers aren't same distance"); + assert((size_t) (pe - p) == len - off && "pointers aren't same distance"); -#line 86 "ext/puma_http11/http11_parser.c" +#line 87 "ext/puma_http11/http11_parser.c" { if ( p == pe ) goto _test_eof; @@ -104,14 +104,14 @@ case 1: cs = 0; goto _out; tr0: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st2; st2: if ( ++p == pe ) goto _test_eof2; case 2: -#line 117 "ext/puma_http11/http11_parser.c" +#line 118 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr2; case 36: goto st28; @@ -127,7 +127,7 @@ case 2: goto st28; goto st0; tr2: -#line 47 "ext/puma_http11/http11_parser.rl" +#line 48 "ext/puma_http11/http11_parser.rl" { parser->request_method(parser, PTR_TO(mark), LEN(mark, p)); } @@ -136,7 +136,7 @@ case 2: if ( ++p == pe ) goto _test_eof3; case 3: -#line 142 "ext/puma_http11/http11_parser.c" +#line 143 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 42: goto tr4; case 43: goto tr5; @@ -153,67 +153,67 @@ case 3: goto tr5; goto st0; tr4: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st4; st4: if ( ++p == pe ) goto _test_eof4; case 4: -#line 166 "ext/puma_http11/http11_parser.c" +#line 167 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr8; case 35: goto tr9; } goto st0; tr8: -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st5; tr31: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } -#line 53 "ext/puma_http11/http11_parser.rl" +#line 54 "ext/puma_http11/http11_parser.rl" { parser->fragment(parser, PTR_TO(mark), LEN(mark, p)); } goto st5; tr33: -#line 53 "ext/puma_http11/http11_parser.rl" +#line 54 "ext/puma_http11/http11_parser.rl" { parser->fragment(parser, PTR_TO(mark), LEN(mark, p)); } goto st5; tr37: -#line 66 "ext/puma_http11/http11_parser.rl" +#line 67 "ext/puma_http11/http11_parser.rl" { parser->request_path(parser, PTR_TO(mark), LEN(mark,p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st5; tr44: -#line 57 "ext/puma_http11/http11_parser.rl" - { MARK(query_start, p); } #line 58 "ext/puma_http11/http11_parser.rl" + { MARK(query_start, p); } +#line 59 "ext/puma_http11/http11_parser.rl" { parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st5; tr47: -#line 58 "ext/puma_http11/http11_parser.rl" +#line 59 "ext/puma_http11/http11_parser.rl" { parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } @@ -222,19 +222,19 @@ case 4: if ( ++p == pe ) goto _test_eof5; case 5: -#line 228 "ext/puma_http11/http11_parser.c" +#line 229 "ext/puma_http11/http11_parser.c" if ( (*p) == 72 ) goto tr10; goto st0; tr10: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st6; st6: if ( ++p == pe ) goto _test_eof6; case 6: -#line 240 "ext/puma_http11/http11_parser.c" +#line 241 "ext/puma_http11/http11_parser.c" if ( (*p) == 84 ) goto st7; goto st0; @@ -292,21 +292,21 @@ case 13: goto st13; goto st0; tr18: -#line 62 "ext/puma_http11/http11_parser.rl" +#line 63 "ext/puma_http11/http11_parser.rl" { parser->http_version(parser, PTR_TO(mark), LEN(mark, p)); } goto st14; tr26: -#line 43 "ext/puma_http11/http11_parser.rl" - { MARK(mark, p); } #line 44 "ext/puma_http11/http11_parser.rl" + { MARK(mark, p); } +#line 45 "ext/puma_http11/http11_parser.rl" { parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } goto st14; tr29: -#line 44 "ext/puma_http11/http11_parser.rl" +#line 45 "ext/puma_http11/http11_parser.rl" { parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } @@ -315,7 +315,7 @@ case 13: if ( ++p == pe ) goto _test_eof14; case 14: -#line 321 "ext/puma_http11/http11_parser.c" +#line 322 "ext/puma_http11/http11_parser.c" if ( (*p) == 10 ) goto st15; goto st0; @@ -355,7 +355,7 @@ case 16: goto tr22; goto st0; tr22: -#line 70 "ext/puma_http11/http11_parser.rl" +#line 71 "ext/puma_http11/http11_parser.rl" { parser->body_start = p - buffer + 1; parser->header_done(parser, p + 1, pe - p - 1); @@ -366,23 +366,23 @@ case 16: if ( ++p == pe ) goto _test_eof47; case 47: -#line 372 "ext/puma_http11/http11_parser.c" +#line 373 "ext/puma_http11/http11_parser.c" goto st0; tr21: -#line 37 "ext/puma_http11/http11_parser.rl" - { MARK(field_start, p); } #line 38 "ext/puma_http11/http11_parser.rl" + { MARK(field_start, p); } +#line 39 "ext/puma_http11/http11_parser.rl" { snake_upcase_char((char *)p); } goto st17; tr23: -#line 38 "ext/puma_http11/http11_parser.rl" +#line 39 "ext/puma_http11/http11_parser.rl" { snake_upcase_char((char *)p); } goto st17; st17: if ( ++p == pe ) goto _test_eof17; case 17: -#line 388 "ext/puma_http11/http11_parser.c" +#line 389 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 33: goto tr23; case 58: goto tr24; @@ -408,71 +408,71 @@ case 17: goto tr23; goto st0; tr24: -#line 39 "ext/puma_http11/http11_parser.rl" +#line 40 "ext/puma_http11/http11_parser.rl" { parser->field_len = LEN(field_start, p); } goto st18; tr27: -#line 43 "ext/puma_http11/http11_parser.rl" +#line 44 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st18; st18: if ( ++p == pe ) goto _test_eof18; case 18: -#line 427 "ext/puma_http11/http11_parser.c" +#line 428 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 13: goto tr26; case 32: goto tr27; } goto tr25; tr25: -#line 43 "ext/puma_http11/http11_parser.rl" +#line 44 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st19; st19: if ( ++p == pe ) goto _test_eof19; case 19: -#line 441 "ext/puma_http11/http11_parser.c" +#line 442 "ext/puma_http11/http11_parser.c" if ( (*p) == 13 ) goto tr29; goto st19; tr9: -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st20; tr38: -#line 66 "ext/puma_http11/http11_parser.rl" +#line 67 "ext/puma_http11/http11_parser.rl" { parser->request_path(parser, PTR_TO(mark), LEN(mark,p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st20; tr45: -#line 57 "ext/puma_http11/http11_parser.rl" - { MARK(query_start, p); } #line 58 "ext/puma_http11/http11_parser.rl" + { MARK(query_start, p); } +#line 59 "ext/puma_http11/http11_parser.rl" { parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } goto st20; tr48: -#line 58 "ext/puma_http11/http11_parser.rl" +#line 59 "ext/puma_http11/http11_parser.rl" { parser->query_string(parser, PTR_TO(query_start), LEN(query_start, p)); } -#line 50 "ext/puma_http11/http11_parser.rl" +#line 51 "ext/puma_http11/http11_parser.rl" { parser->request_uri(parser, PTR_TO(mark), LEN(mark, p)); } @@ -481,7 +481,7 @@ case 19: if ( ++p == pe ) goto _test_eof20; case 20: -#line 487 "ext/puma_http11/http11_parser.c" +#line 488 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr31; case 60: goto st0; @@ -495,14 +495,14 @@ case 20: goto st0; goto tr30; tr30: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st21; st21: if ( ++p == pe ) goto _test_eof21; case 21: -#line 508 "ext/puma_http11/http11_parser.c" +#line 509 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr33; case 60: goto st0; @@ -516,14 +516,14 @@ case 21: goto st0; goto st21; tr5: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st22; st22: if ( ++p == pe ) goto _test_eof22; case 22: -#line 529 "ext/puma_http11/http11_parser.c" +#line 530 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 43: goto st22; case 58: goto st23; @@ -541,14 +541,14 @@ case 22: goto st22; goto st0; tr7: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st23; st23: if ( ++p == pe ) goto _test_eof23; case 23: -#line 554 "ext/puma_http11/http11_parser.c" +#line 555 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr8; case 34: goto st0; @@ -561,14 +561,14 @@ case 23: goto st0; goto st23; tr6: -#line 34 "ext/puma_http11/http11_parser.rl" +#line 35 "ext/puma_http11/http11_parser.rl" { MARK(mark, p); } goto st24; st24: if ( ++p == pe ) goto _test_eof24; case 24: -#line 574 "ext/puma_http11/http11_parser.c" +#line 575 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr37; case 34: goto st0; @@ -583,7 +583,7 @@ case 24: goto st0; goto st24; tr39: -#line 66 "ext/puma_http11/http11_parser.rl" +#line 67 "ext/puma_http11/http11_parser.rl" { parser->request_path(parser, PTR_TO(mark), LEN(mark,p)); } @@ -592,7 +592,7 @@ case 24: if ( ++p == pe ) goto _test_eof25; case 25: -#line 598 "ext/puma_http11/http11_parser.c" +#line 599 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr8; case 34: goto st0; @@ -606,7 +606,7 @@ case 25: goto st0; goto st25; tr40: -#line 66 "ext/puma_http11/http11_parser.rl" +#line 67 "ext/puma_http11/http11_parser.rl" { parser->request_path(parser, PTR_TO(mark), LEN(mark,p)); } @@ -615,7 +615,7 @@ case 25: if ( ++p == pe ) goto _test_eof26; case 26: -#line 621 "ext/puma_http11/http11_parser.c" +#line 622 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr44; case 34: goto st0; @@ -628,14 +628,14 @@ case 26: goto st0; goto tr43; tr43: -#line 57 "ext/puma_http11/http11_parser.rl" +#line 58 "ext/puma_http11/http11_parser.rl" { MARK(query_start, p); } goto st27; st27: if ( ++p == pe ) goto _test_eof27; case 27: -#line 641 "ext/puma_http11/http11_parser.c" +#line 642 "ext/puma_http11/http11_parser.c" switch( (*p) ) { case 32: goto tr47; case 34: goto st0; @@ -1030,7 +1030,7 @@ case 46: _out: {} } -#line 114 "ext/puma_http11/http11_parser.rl" +#line 115 "ext/puma_http11/http11_parser.rl" if (!puma_parser_has_error(parser)) parser->cs = cs; diff --git a/ext/puma_http11/http11_parser.rl b/ext/puma_http11/http11_parser.rl index ac01d58a85..880c1d40be 100644 --- a/ext/puma_http11/http11_parser.rl +++ b/ext/puma_http11/http11_parser.rl @@ -29,7 +29,7 @@ static void snake_upcase_char(char *c) /** Machine **/ %%{ - + machine puma_parser; action mark { MARK(mark, fpc); } @@ -37,7 +37,7 @@ static void snake_upcase_char(char *c) action start_field { MARK(field_start, fpc); } action snake_upcase_field { snake_upcase_char((char *)fpc); } - action write_field { + action write_field { parser->field_len = LEN(field_start, fpc); } @@ -45,10 +45,10 @@ static void snake_upcase_char(char *c) action write_value { parser->http_field(parser, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, fpc)); } - action request_method { + action request_method { parser->request_method(parser, PTR_TO(mark), LEN(mark, fpc)); } - action request_uri { + action request_uri { parser->request_uri(parser, PTR_TO(mark), LEN(mark, fpc)); } action fragment { @@ -56,11 +56,11 @@ static void snake_upcase_char(char *c) } action start_query { MARK(query_start, fpc); } - action query_string { + action query_string { parser->query_string(parser, PTR_TO(query_start), LEN(query_start, fpc)); } - action http_version { + action http_version { parser->http_version(parser, PTR_TO(mark), LEN(mark, fpc)); } @@ -68,8 +68,8 @@ static void snake_upcase_char(char *c) parser->request_path(parser, PTR_TO(mark), LEN(mark,fpc)); } - action done { - parser->body_start = fpc - buffer + 1; + action done { + parser->body_start = fpc - buffer + 1; parser->header_done(parser, fpc + 1, pe - fpc - 1); fbreak; } @@ -109,7 +109,7 @@ size_t puma_parser_execute(puma_parser *parser, const char *buffer, size_t len, pe = buffer+len; /* assert(*pe == '\0' && "pointer does not end on NUL"); */ - assert(pe - p == len - off && "pointers aren't same distance"); + assert((size_t) (pe - p) == len - off && "pointers aren't same distance"); %% write exec;