ext/http11_client/http11_parser.c in rev-0.2.0 vs ext/http11_client/http11_parser.c in rev-0.2.1

- old
+ new

@@ -1,6 +1,6 @@ -#line 1 "ext/http11_client/http11_parser.rl" +#line 1 "http11_parser.rl" /** * Copyright (c) 2005 Zed A. Shaw * You can redistribute it and/or modify it under the same terms as Ruby. */ @@ -16,32 +16,32 @@ #define PTR_TO(F) (buffer + parser->F) #define L(M) fprintf(stderr, "" # M "\n"); /** machine **/ -#line 95 "ext/http11_client/http11_parser.rl" +#line 95 "http11_parser.rl" /** Data **/ -#line 27 "ext/http11_client/http11_parser.c" -static const int httpclient_parser_start = 0; +#line 27 "http11_parser.c" +static const int httpclient_parser_start = 1; +static const int httpclient_parser_first_final = 37; +static const int httpclient_parser_error = 0; -static const int httpclient_parser_first_final = 36; +static const int httpclient_parser_en_main = 1; -static const int httpclient_parser_error = 1; +#line 99 "http11_parser.rl" -#line 99 "ext/http11_client/http11_parser.rl" - int httpclient_parser_init(httpclient_parser *parser) { int cs = 0; -#line 39 "ext/http11_client/http11_parser.c" +#line 39 "http11_parser.c" { cs = httpclient_parser_start; } -#line 103 "ext/http11_client/http11_parser.rl" +#line 103 "http11_parser.rl" parser->cs = cs; parser->body_start = 0; parser->content_len = 0; parser->mark = 0; parser->nread = 0; @@ -65,908 +65,968 @@ assert(*pe == '\0' && "pointer does not end on NUL"); assert(pe - p == len - off && "pointers aren't same distance"); -#line 71 "ext/http11_client/http11_parser.c" +#line 71 "http11_parser.c" { if ( p == pe ) goto _out; switch ( cs ) { -case 0: +case 1: switch( (*p) ) { case 13: goto st2; - case 48: goto tr16; - case 59: goto st15; - case 72: goto tr19; + case 48: goto tr2; + case 59: goto st16; + case 72: goto tr5; } if ( (*p) < 65 ) { if ( 49 <= (*p) && (*p) <= 57 ) - goto tr17; + goto tr3; } else if ( (*p) > 70 ) { if ( 97 <= (*p) && (*p) <= 102 ) - goto tr17; + goto tr3; } else - goto tr17; - goto st1; -st1: - goto _out1; -tr44: -#line 33 "ext/http11_client/http11_parser.rl" + goto tr3; + goto st0; +st0: + goto _out0; +tr38: +#line 27 "http11_parser.rl" { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } - goto st2; -tr52: -#line 27 "ext/http11_client/http11_parser.rl" - { parser->field_len = LEN(field_start, p); } -#line 31 "ext/http11_client/http11_parser.rl" +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" +#line 33 "http11_parser.rl" { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } goto st2; +tr43: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st2; st2: if ( ++p == pe ) goto _out2; case 2: -#line 117 "ext/http11_client/http11_parser.c" +#line 117 "http11_parser.c" if ( (*p) == 10 ) - goto tr34; - goto st1; -tr33: -#line 57 "ext/http11_client/http11_parser.rl" + goto tr6; + goto st0; +tr6: +#line 53 "http11_parser.rl" + { + parser->last_chunk(parser->data, NULL, 0); + } +#line 57 "http11_parser.rl" { parser->body_start = p - buffer + 1; if(parser->header_done != NULL) parser->header_done(parser->data, p + 1, pe - p - 1); - goto _out36; + goto _out37; } - goto st36; -tr34: -#line 53 "ext/http11_client/http11_parser.rl" - { - parser->last_chunk(parser->data, NULL, 0); - } -#line 57 "ext/http11_client/http11_parser.rl" + goto st37; +tr13: +#line 57 "http11_parser.rl" { parser->body_start = p - buffer + 1; if(parser->header_done != NULL) parser->header_done(parser->data, p + 1, pe - p - 1); - goto _out36; + goto _out37; } - goto st36; -tr35: -#line 57 "ext/http11_client/http11_parser.rl" + goto st37; +tr14: +#line 57 "http11_parser.rl" { parser->body_start = p - buffer + 1; if(parser->header_done != NULL) parser->header_done(parser->data, p + 1, pe - p - 1); - goto _out36; + goto _out37; } -#line 53 "ext/http11_client/http11_parser.rl" +#line 53 "http11_parser.rl" { parser->last_chunk(parser->data, NULL, 0); } - goto st36; -st36: + goto st37; +st37: if ( ++p == pe ) - goto _out36; -case 36: -#line 160 "ext/http11_client/http11_parser.c" - goto st1; -tr16: -#line 23 "ext/http11_client/http11_parser.rl" + goto _out37; +case 37: +#line 160 "http11_parser.c" + goto st0; +tr2: +#line 23 "http11_parser.rl" {MARK(mark, p); } goto st3; st3: if ( ++p == pe ) goto _out3; case 3: -#line 170 "ext/http11_client/http11_parser.c" +#line 170 "http11_parser.c" switch( (*p) ) { - case 13: goto tr50; - case 59: goto tr51; + case 13: goto tr8; + case 32: goto tr7; + case 59: goto tr10; } - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st5; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st5; + if ( (*p) < 48 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr7; + } else if ( (*p) > 57 ) { + if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st7; + } else if ( (*p) >= 65 ) + goto st7; } else - goto st5; - goto st1; -tr47: -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } - goto st4; -tr50: -#line 49 "ext/http11_client/http11_parser.rl" + goto st7; + goto st0; +tr7: +#line 49 "http11_parser.rl" { parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); } goto st4; -tr56: -#line 27 "ext/http11_client/http11_parser.rl" +tr18: +#line 27 "http11_parser.rl" { parser->field_len = LEN(field_start, p); } -#line 31 "ext/http11_client/http11_parser.rl" +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" +#line 33 "http11_parser.rl" { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } goto st4; +tr24: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st4; st4: if ( ++p == pe ) goto _out4; case 4: -#line 212 "ext/http11_client/http11_parser.c" - if ( (*p) == 10 ) - goto tr35; - goto st1; -tr17: -#line 23 "ext/http11_client/http11_parser.rl" - {MARK(mark, p); } - goto st5; -st5: - if ( ++p == pe ) - goto _out5; -case 5: -#line 224 "ext/http11_client/http11_parser.c" +#line 216 "http11_parser.c" switch( (*p) ) { - case 13: goto tr25; - case 59: goto tr27; + case 13: goto st5; + case 32: goto st4; } - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st5; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st5; - } else - goto st5; - goto st1; -tr22: -#line 33 "ext/http11_client/http11_parser.rl" + if ( 9 <= (*p) && (*p) <= 12 ) + goto st4; + goto st0; +tr15: +#line 49 "http11_parser.rl" + { + parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); + } + goto st5; +tr19: +#line 27 "http11_parser.rl" { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" + { MARK(mark, p); } +#line 33 "http11_parser.rl" + { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } - goto st6; + goto st5; tr25: -#line 49 "ext/http11_client/http11_parser.rl" +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st5; +st5: + if ( ++p == pe ) + goto _out5; +case 5: +#line 252 "http11_parser.c" + if ( (*p) == 10 ) + goto tr13; + goto st0; +tr8: +#line 49 "http11_parser.rl" { parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); } goto st6; -tr28: -#line 27 "ext/http11_client/http11_parser.rl" +tr29: +#line 27 "http11_parser.rl" { parser->field_len = LEN(field_start, p); } -#line 31 "ext/http11_client/http11_parser.rl" +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" +#line 33 "http11_parser.rl" { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } goto st6; +tr34: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st6; st6: if ( ++p == pe ) goto _out6; case 6: -#line 266 "ext/http11_client/http11_parser.c" +#line 284 "http11_parser.c" if ( (*p) == 10 ) - goto tr33; - goto st1; -tr24: -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } + goto tr14; + goto st0; +tr3: +#line 23 "http11_parser.rl" + {MARK(mark, p); } goto st7; -tr27: -#line 49 "ext/http11_client/http11_parser.rl" +st7: + if ( ++p == pe ) + goto _out7; +case 7: +#line 296 "http11_parser.c" + switch( (*p) ) { + case 13: goto tr15; + case 32: goto tr7; + case 59: goto tr16; + } + if ( (*p) < 48 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr7; + } else if ( (*p) > 57 ) { + if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st7; + } else if ( (*p) >= 65 ) + goto st7; + } else + goto st7; + goto st0; +tr16: +#line 49 "http11_parser.rl" { parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); } - goto st7; -tr30: -#line 27 "ext/http11_client/http11_parser.rl" + goto st8; +tr21: +#line 27 "http11_parser.rl" { parser->field_len = LEN(field_start, p); } -#line 31 "ext/http11_client/http11_parser.rl" +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" +#line 33 "http11_parser.rl" { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } - goto st7; -st7: - if ( ++p == pe ) - goto _out7; -case 7: -#line 298 "ext/http11_client/http11_parser.c" - switch( (*p) ) { - case 33: goto tr9; - case 124: goto tr9; - case 126: goto tr9; - } - if ( (*p) < 45 ) { - if ( (*p) > 39 ) { - if ( 42 <= (*p) && (*p) <= 43 ) - goto tr9; - } else if ( (*p) >= 35 ) - goto tr9; - } else if ( (*p) > 46 ) { - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto tr9; - } else if ( (*p) > 90 ) { - if ( 94 <= (*p) && (*p) <= 122 ) - goto tr9; - } else - goto tr9; - } else - goto tr9; - goto st1; -tr9: -#line 25 "ext/http11_client/http11_parser.rl" - { MARK(field_start, p); } goto st8; +tr27: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st8; st8: if ( ++p == pe ) goto _out8; case 8: -#line 330 "ext/http11_client/http11_parser.c" +#line 342 "http11_parser.c" switch( (*p) ) { - case 13: goto tr28; - case 33: goto st8; - case 59: goto tr30; - case 61: goto tr31; - case 124: goto st8; - case 126: goto st8; + case 33: goto tr17; + case 124: goto tr17; + case 126: goto tr17; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st8; + goto tr17; } else if ( (*p) >= 35 ) - goto st8; + goto tr17; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st8; + goto tr17; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st8; + goto tr17; } else - goto st8; + goto tr17; } else - goto st8; - goto st1; -tr31: -#line 27 "ext/http11_client/http11_parser.rl" - { - parser->field_len = LEN(field_start, p); - } -#line 31 "ext/http11_client/http11_parser.rl" - { MARK(mark, p); } + goto tr17; + goto st0; +tr17: +#line 25 "http11_parser.rl" + { MARK(field_start, p); } goto st9; st9: if ( ++p == pe ) goto _out9; case 9: -#line 369 "ext/http11_client/http11_parser.c" +#line 374 "http11_parser.c" switch( (*p) ) { - case 33: goto tr10; - case 124: goto tr10; - case 126: goto tr10; + case 13: goto tr19; + case 32: goto tr18; + case 33: goto st9; + case 59: goto tr21; + case 61: goto tr22; + case 124: goto st9; + case 126: goto st9; } if ( (*p) < 45 ) { - if ( (*p) > 39 ) { + if ( (*p) < 35 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr18; + } else if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr10; - } else if ( (*p) >= 35 ) - goto tr10; + goto st9; + } else + goto st9; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr10; + goto st9; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr10; + goto st9; } else - goto tr10; + goto st9; } else - goto tr10; - goto st1; -tr10: -#line 31 "ext/http11_client/http11_parser.rl" + goto st9; + goto st0; +tr22: +#line 27 "http11_parser.rl" + { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" { MARK(mark, p); } goto st10; st10: if ( ++p == pe ) goto _out10; case 10: -#line 401 "ext/http11_client/http11_parser.c" +#line 417 "http11_parser.c" switch( (*p) ) { - case 13: goto tr22; - case 33: goto st10; - case 59: goto tr24; - case 124: goto st10; - case 126: goto st10; + case 33: goto tr23; + case 124: goto tr23; + case 126: goto tr23; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st10; + goto tr23; } else if ( (*p) >= 35 ) - goto st10; + goto tr23; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st10; + goto tr23; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st10; + goto tr23; } else - goto st10; + goto tr23; } else - goto st10; - goto st1; -tr49: -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } - goto st11; -tr51: -#line 49 "ext/http11_client/http11_parser.rl" - { - parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st11; -tr58: -#line 27 "ext/http11_client/http11_parser.rl" - { - parser->field_len = LEN(field_start, p); - } -#line 31 "ext/http11_client/http11_parser.rl" + goto tr23; + goto st0; +tr23: +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } goto st11; st11: if ( ++p == pe ) goto _out11; case 11: -#line 455 "ext/http11_client/http11_parser.c" +#line 449 "http11_parser.c" switch( (*p) ) { - case 33: goto tr63; - case 124: goto tr63; - case 126: goto tr63; + case 13: goto tr25; + case 32: goto tr24; + case 33: goto st11; + case 59: goto tr27; + case 124: goto st11; + case 126: goto st11; } if ( (*p) < 45 ) { - if ( (*p) > 39 ) { + if ( (*p) < 35 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr24; + } else if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr63; - } else if ( (*p) >= 35 ) - goto tr63; + goto st11; + } else + goto st11; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr63; + goto st11; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr63; + goto st11; } else - goto tr63; + goto st11; } else - goto tr63; - goto st1; -tr63: -#line 25 "ext/http11_client/http11_parser.rl" - { MARK(field_start, p); } + goto st11; + goto st0; +tr10: +#line 49 "http11_parser.rl" + { + parser->chunk_size(parser->data, PTR_TO(mark), LEN(mark, p)); + } goto st12; +tr31: +#line 27 "http11_parser.rl" + { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" + { MARK(mark, p); } +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st12; +tr36: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st12; st12: if ( ++p == pe ) goto _out12; case 12: -#line 487 "ext/http11_client/http11_parser.c" +#line 507 "http11_parser.c" switch( (*p) ) { - case 13: goto tr56; - case 33: goto st12; - case 59: goto tr58; - case 61: goto tr59; - case 124: goto st12; - case 126: goto st12; + case 33: goto tr28; + case 124: goto tr28; + case 126: goto tr28; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st12; + goto tr28; } else if ( (*p) >= 35 ) - goto st12; + goto tr28; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st12; + goto tr28; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st12; + goto tr28; } else - goto st12; + goto tr28; } else - goto st12; - goto st1; -tr59: -#line 27 "ext/http11_client/http11_parser.rl" - { - parser->field_len = LEN(field_start, p); - } -#line 31 "ext/http11_client/http11_parser.rl" - { MARK(mark, p); } + goto tr28; + goto st0; +tr28: +#line 25 "http11_parser.rl" + { MARK(field_start, p); } goto st13; st13: if ( ++p == pe ) goto _out13; case 13: -#line 526 "ext/http11_client/http11_parser.c" +#line 539 "http11_parser.c" switch( (*p) ) { - case 33: goto tr61; - case 124: goto tr61; - case 126: goto tr61; + case 13: goto tr29; + case 32: goto tr18; + case 33: goto st13; + case 59: goto tr31; + case 61: goto tr32; + case 124: goto st13; + case 126: goto st13; } if ( (*p) < 45 ) { - if ( (*p) > 39 ) { + if ( (*p) < 35 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr18; + } else if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr61; - } else if ( (*p) >= 35 ) - goto tr61; + goto st13; + } else + goto st13; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr61; + goto st13; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr61; + goto st13; } else - goto tr61; + goto st13; } else - goto tr61; - goto st1; -tr61: -#line 31 "ext/http11_client/http11_parser.rl" + goto st13; + goto st0; +tr32: +#line 27 "http11_parser.rl" + { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" { MARK(mark, p); } goto st14; st14: if ( ++p == pe ) goto _out14; case 14: -#line 558 "ext/http11_client/http11_parser.c" +#line 582 "http11_parser.c" switch( (*p) ) { - case 13: goto tr47; - case 33: goto st14; - case 59: goto tr49; - case 124: goto st14; - case 126: goto st14; + case 33: goto tr33; + case 124: goto tr33; + case 126: goto tr33; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st14; + goto tr33; } else if ( (*p) >= 35 ) - goto st14; + goto tr33; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st14; + goto tr33; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st14; + goto tr33; } else - goto st14; + goto tr33; } else - goto st14; - goto st1; -tr46: -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } - goto st15; -tr54: -#line 27 "ext/http11_client/http11_parser.rl" - { - parser->field_len = LEN(field_start, p); - } -#line 31 "ext/http11_client/http11_parser.rl" + goto tr33; + goto st0; +tr33: +#line 31 "http11_parser.rl" { MARK(mark, p); } -#line 33 "ext/http11_client/http11_parser.rl" - { - parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); - } goto st15; st15: if ( ++p == pe ) goto _out15; case 15: -#line 606 "ext/http11_client/http11_parser.c" +#line 614 "http11_parser.c" switch( (*p) ) { - case 33: goto tr62; - case 124: goto tr62; - case 126: goto tr62; + case 13: goto tr34; + case 32: goto tr24; + case 33: goto st15; + case 59: goto tr36; + case 124: goto st15; + case 126: goto st15; } if ( (*p) < 45 ) { - if ( (*p) > 39 ) { + if ( (*p) < 35 ) { + if ( 9 <= (*p) && (*p) <= 12 ) + goto tr24; + } else if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr62; - } else if ( (*p) >= 35 ) - goto tr62; + goto st15; + } else + goto st15; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr62; + goto st15; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr62; + goto st15; } else - goto tr62; + goto st15; } else - goto tr62; - goto st1; -tr62: -#line 25 "ext/http11_client/http11_parser.rl" - { MARK(field_start, p); } + goto st15; + goto st0; +tr40: +#line 27 "http11_parser.rl" + { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" + { MARK(mark, p); } +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } goto st16; +tr45: +#line 33 "http11_parser.rl" + { + parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); + } + goto st16; st16: if ( ++p == pe ) goto _out16; case 16: -#line 638 "ext/http11_client/http11_parser.c" +#line 666 "http11_parser.c" switch( (*p) ) { - case 13: goto tr52; - case 33: goto st16; - case 59: goto tr54; - case 61: goto tr55; - case 124: goto st16; - case 126: goto st16; + case 33: goto tr37; + case 124: goto tr37; + case 126: goto tr37; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st16; + goto tr37; } else if ( (*p) >= 35 ) - goto st16; + goto tr37; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st16; + goto tr37; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st16; + goto tr37; } else - goto st16; + goto tr37; } else - goto st16; - goto st1; -tr55: -#line 27 "ext/http11_client/http11_parser.rl" - { - parser->field_len = LEN(field_start, p); - } -#line 31 "ext/http11_client/http11_parser.rl" - { MARK(mark, p); } + goto tr37; + goto st0; +tr37: +#line 25 "http11_parser.rl" + { MARK(field_start, p); } goto st17; st17: if ( ++p == pe ) goto _out17; case 17: -#line 677 "ext/http11_client/http11_parser.c" +#line 698 "http11_parser.c" switch( (*p) ) { - case 33: goto tr60; - case 124: goto tr60; - case 126: goto tr60; + case 13: goto tr38; + case 33: goto st17; + case 59: goto tr40; + case 61: goto tr41; + case 124: goto st17; + case 126: goto st17; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr60; + goto st17; } else if ( (*p) >= 35 ) - goto tr60; + goto st17; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr60; + goto st17; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr60; + goto st17; } else - goto tr60; + goto st17; } else - goto tr60; - goto st1; -tr60: -#line 31 "ext/http11_client/http11_parser.rl" + goto st17; + goto st0; +tr41: +#line 27 "http11_parser.rl" + { + parser->field_len = LEN(field_start, p); + } +#line 31 "http11_parser.rl" { MARK(mark, p); } goto st18; st18: if ( ++p == pe ) goto _out18; case 18: -#line 709 "ext/http11_client/http11_parser.c" +#line 737 "http11_parser.c" switch( (*p) ) { - case 13: goto tr44; - case 33: goto st18; - case 59: goto tr46; - case 124: goto st18; - case 126: goto st18; + case 33: goto tr42; + case 124: goto tr42; + case 126: goto tr42; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st18; + goto tr42; } else if ( (*p) >= 35 ) - goto st18; + goto tr42; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st18; + goto tr42; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st18; + goto tr42; } else - goto st18; + goto tr42; } else - goto st18; - goto st1; -tr19: -#line 23 "ext/http11_client/http11_parser.rl" - {MARK(mark, p); } + goto tr42; + goto st0; +tr42: +#line 31 "http11_parser.rl" + { MARK(mark, p); } goto st19; st19: if ( ++p == pe ) goto _out19; case 19: -#line 743 "ext/http11_client/http11_parser.c" - if ( (*p) == 84 ) - goto st20; - goto st1; +#line 769 "http11_parser.c" + switch( (*p) ) { + case 13: goto tr43; + case 33: goto st19; + case 59: goto tr45; + case 124: goto st19; + case 126: goto st19; + } + if ( (*p) < 45 ) { + if ( (*p) > 39 ) { + if ( 42 <= (*p) && (*p) <= 43 ) + goto st19; + } else if ( (*p) >= 35 ) + goto st19; + } else if ( (*p) > 46 ) { + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st19; + } else if ( (*p) > 90 ) { + if ( 94 <= (*p) && (*p) <= 122 ) + goto st19; + } else + goto st19; + } else + goto st19; + goto st0; +tr5: +#line 23 "http11_parser.rl" + {MARK(mark, p); } + goto st20; st20: if ( ++p == pe ) goto _out20; case 20: +#line 803 "http11_parser.c" if ( (*p) == 84 ) goto st21; - goto st1; + goto st0; st21: if ( ++p == pe ) goto _out21; case 21: - if ( (*p) == 80 ) + if ( (*p) == 84 ) goto st22; - goto st1; + goto st0; st22: if ( ++p == pe ) goto _out22; case 22: - if ( (*p) == 47 ) + if ( (*p) == 80 ) goto st23; - goto st1; + goto st0; st23: if ( ++p == pe ) goto _out23; case 23: - if ( 48 <= (*p) && (*p) <= 57 ) + if ( (*p) == 47 ) goto st24; - goto st1; + goto st0; st24: if ( ++p == pe ) goto _out24; case 24: - if ( (*p) == 46 ) - goto st25; if ( 48 <= (*p) && (*p) <= 57 ) - goto st24; - goto st1; + goto st25; + goto st0; st25: if ( ++p == pe ) goto _out25; case 25: - if ( 48 <= (*p) && (*p) <= 57 ) + if ( (*p) == 46 ) goto st26; - goto st1; + if ( 48 <= (*p) && (*p) <= 57 ) + goto st25; + goto st0; st26: if ( ++p == pe ) goto _out26; case 26: - if ( (*p) == 32 ) - goto tr13; if ( 48 <= (*p) && (*p) <= 57 ) - goto st26; - goto st1; -tr13: -#line 45 "ext/http11_client/http11_parser.rl" - { - parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st27; + goto st27; + goto st0; st27: if ( ++p == pe ) goto _out27; case 27: -#line 810 "ext/http11_client/http11_parser.c" + if ( (*p) == 32 ) + goto tr53; if ( 48 <= (*p) && (*p) <= 57 ) - goto tr4; - goto st1; -tr4: -#line 23 "ext/http11_client/http11_parser.rl" - {MARK(mark, p); } + goto st27; + goto st0; +tr53: +#line 45 "http11_parser.rl" + { + parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p)); + } goto st28; st28: if ( ++p == pe ) goto _out28; case 28: -#line 822 "ext/http11_client/http11_parser.c" - if ( (*p) == 32 ) - goto tr11; +#line 870 "http11_parser.c" if ( 48 <= (*p) && (*p) <= 57 ) - goto st28; - goto st1; -tr11: -#line 41 "ext/http11_client/http11_parser.rl" - { - parser->status_code(parser->data, PTR_TO(mark), LEN(mark, p)); - } + goto tr54; + goto st0; +tr54: +#line 23 "http11_parser.rl" + {MARK(mark, p); } goto st29; st29: if ( ++p == pe ) goto _out29; case 29: -#line 838 "ext/http11_client/http11_parser.c" - goto tr40; -tr40: -#line 23 "ext/http11_client/http11_parser.rl" - {MARK(mark, p); } +#line 882 "http11_parser.c" + if ( (*p) == 32 ) + goto tr55; + if ( 48 <= (*p) && (*p) <= 57 ) + goto st29; + goto st0; +tr55: +#line 41 "http11_parser.rl" + { + parser->status_code(parser->data, PTR_TO(mark), LEN(mark, p)); + } goto st30; st30: if ( ++p == pe ) goto _out30; case 30: -#line 848 "ext/http11_client/http11_parser.c" +#line 898 "http11_parser.c" + goto tr57; +tr57: +#line 23 "http11_parser.rl" + {MARK(mark, p); } + goto st31; +st31: + if ( ++p == pe ) + goto _out31; +case 31: +#line 908 "http11_parser.c" if ( (*p) == 13 ) - goto tr39; - goto st30; -tr37: -#line 33 "ext/http11_client/http11_parser.rl" + goto tr59; + goto st31; +tr65: +#line 33 "http11_parser.rl" { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); } - goto st31; -tr39: -#line 37 "ext/http11_client/http11_parser.rl" + goto st32; +tr59: +#line 37 "http11_parser.rl" { parser->reason_phrase(parser->data, PTR_TO(mark), LEN(mark, p)); } - goto st31; -st31: - if ( ++p == pe ) - goto _out31; -case 31: -#line 868 "ext/http11_client/http11_parser.c" - if ( (*p) == 10 ) - goto st32; - goto st1; + goto st32; st32: if ( ++p == pe ) goto _out32; case 32: +#line 928 "http11_parser.c" + if ( (*p) == 10 ) + goto st33; + goto st0; +st33: + if ( ++p == pe ) + goto _out33; +case 33: switch( (*p) ) { - case 13: goto st6; - case 33: goto tr21; - case 124: goto tr21; - case 126: goto tr21; + case 13: goto st5; + case 33: goto tr61; + case 124: goto tr61; + case 126: goto tr61; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr21; + goto tr61; } else if ( (*p) >= 35 ) - goto tr21; + goto tr61; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr21; + goto tr61; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr21; + goto tr61; } else - goto tr21; + goto tr61; } else - goto tr21; - goto st1; -tr21: -#line 25 "ext/http11_client/http11_parser.rl" + goto tr61; + goto st0; +tr61: +#line 25 "http11_parser.rl" { MARK(field_start, p); } - goto st33; -st33: + goto st34; +st34: if ( ++p == pe ) - goto _out33; -case 33: -#line 908 "ext/http11_client/http11_parser.c" + goto _out34; +case 34: +#line 968 "http11_parser.c" switch( (*p) ) { - case 33: goto st33; - case 58: goto tr8; - case 124: goto st33; - case 126: goto st33; + case 33: goto st34; + case 58: goto tr63; + case 124: goto st34; + case 126: goto st34; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto st33; + goto st34; } else if ( (*p) >= 35 ) - goto st33; + goto st34; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st33; + goto st34; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto st33; + goto st34; } else - goto st33; + goto st34; } else - goto st33; - goto st1; -tr8: -#line 27 "ext/http11_client/http11_parser.rl" + goto st34; + goto st0; +tr66: +#line 31 "http11_parser.rl" + { MARK(mark, p); } + goto st35; +tr63: +#line 27 "http11_parser.rl" { parser->field_len = LEN(field_start, p); } - goto st34; -tr42: -#line 31 "ext/http11_client/http11_parser.rl" - { MARK(mark, p); } - goto st34; -st34: - if ( ++p == pe ) - goto _out34; -case 34: -#line 947 "ext/http11_client/http11_parser.c" - switch( (*p) ) { - case 13: goto tr37; - case 32: goto tr42; - } - goto tr41; -tr41: -#line 31 "ext/http11_client/http11_parser.rl" - { MARK(mark, p); } goto st35; st35: if ( ++p == pe ) goto _out35; case 35: -#line 961 "ext/http11_client/http11_parser.c" +#line 1007 "http11_parser.c" + switch( (*p) ) { + case 13: goto tr65; + case 32: goto tr66; + } + goto tr64; +tr64: +#line 31 "http11_parser.rl" + { MARK(mark, p); } + goto st36; +st36: + if ( ++p == pe ) + goto _out36; +case 36: +#line 1021 "http11_parser.c" if ( (*p) == 13 ) - goto tr37; - goto st35; + goto tr65; + goto st36; } - _out1: cs = 1; goto _out; + _out0: cs = 0; goto _out; _out2: cs = 2; goto _out; - _out36: cs = 36; goto _out; + _out37: cs = 37; goto _out; _out3: cs = 3; goto _out; _out4: cs = 4; goto _out; _out5: cs = 5; goto _out; _out6: cs = 6; goto _out; _out7: cs = 7; goto _out; @@ -996,14 +1056,15 @@ _out31: cs = 31; goto _out; _out32: cs = 32; goto _out; _out33: cs = 33; goto _out; _out34: cs = 34; goto _out; _out35: cs = 35; goto _out; + _out36: cs = 36; goto _out; _out: {} } -#line 130 "ext/http11_client/http11_parser.rl" +#line 130 "http11_parser.rl" parser->cs = cs; parser->nread += p - (buffer + off); assert(p <= pe && "buffer overflow after parsing execute"); @@ -1014,12 +1075,12 @@ assert(parser->field_start < len && "field starts after buffer end"); if(parser->body_start) { /* final \r\n combo encountered so stop right here */ -#line 1020 "ext/http11_client/http11_parser.c" -#line 144 "ext/http11_client/http11_parser.rl" +#line 1081 "http11_parser.c" +#line 144 "http11_parser.rl" parser->nread++; } return(parser->nread); } @@ -1027,11 +1088,11 @@ int httpclient_parser_finish(httpclient_parser *parser) { int cs = parser->cs; -#line 1033 "ext/http11_client/http11_parser.c" -#line 155 "ext/http11_client/http11_parser.rl" +#line 1094 "http11_parser.c" +#line 155 "http11_parser.rl" parser->cs = cs; if (httpclient_parser_has_error(parser) ) { return -1;