From c45b6f077e87b5cbd8cf88e57b9deb6151eefdc7 Mon Sep 17 00:00:00 2001 From: zedshaw Date: Sun, 21 May 2006 14:46:42 +0000 Subject: LGPL preamble on all source files. git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@203 19e92222-5c0b-0410-8929-a290d50e31e9 --- ext/http11/http11.c | 19 ++ ext/http11/http11_parser.c | 652 +++++++++++++++++++------------------------- ext/http11/http11_parser.h | 19 ++ ext/http11/http11_parser.rl | 19 ++ 4 files changed, 332 insertions(+), 377 deletions(-) (limited to 'ext') diff --git a/ext/http11/http11.c b/ext/http11/http11.c index d81f741..870b8d2 100644 --- a/ext/http11/http11.c +++ b/ext/http11/http11.c @@ -1,3 +1,22 @@ +/* Mongrel Web Server - A Mostly Ruby Webserver and Library + * + * Copyright (C) 2005 Zed A. Shaw zedshaw AT zedshaw dot com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "ruby.h" #include "ext_help.h" #include diff --git a/ext/http11/http11_parser.c b/ext/http11/http11_parser.c index 62ede39..5e593bb 100644 --- a/ext/http11/http11_parser.c +++ b/ext/http11/http11_parser.c @@ -1,4 +1,23 @@ #line 1 "ext/http11/http11_parser.rl" +/* Mongrel Web Server - A Mostly Ruby Webserver and Library + * + * Copyright (C) 2005 Zed A. Shaw zedshaw AT zedshaw dot com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "http11_parser.h" #include #include @@ -11,28 +30,28 @@ #define PTR_TO(F) (buffer + parser->F) /** machine **/ -#line 102 "ext/http11/http11_parser.rl" +#line 121 "ext/http11/http11_parser.rl" /** Data **/ -#line 20 "ext/http11/http11_parser.c" +#line 39 "ext/http11/http11_parser.c" static int http_parser_start = 0; -static int http_parser_first_final = 54; +static int http_parser_first_final = 51; static int http_parser_error = 1; -#line 106 "ext/http11/http11_parser.rl" +#line 125 "ext/http11/http11_parser.rl" int http_parser_init(http_parser *parser) { int cs = 0; -#line 32 "ext/http11/http11_parser.c" +#line 51 "ext/http11/http11_parser.c" { cs = http_parser_start; } -#line 110 "ext/http11/http11_parser.rl" +#line 129 "ext/http11/http11_parser.rl" parser->cs = cs; parser->body_start = 0; parser->content_len = 0; @@ -60,7 +79,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, -#line 64 "ext/http11/http11_parser.c" +#line 83 "ext/http11/http11_parser.c" { p -= 1; if ( ++p == pe ) @@ -69,45 +88,45 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len, { case 0: switch( (*p) ) { - case 36: goto tr8; - case 95: goto tr8; + case 36: goto tr14; + case 95: goto tr14; } if ( (*p) < 48 ) { if ( 45 <= (*p) && (*p) <= 46 ) - goto tr8; + goto tr14; } else if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 90 ) - goto tr8; + goto tr14; } else - goto tr8; + goto tr14; goto st1; st1: goto _out1; -tr8: -#line 16 "ext/http11/http11_parser.rl" +tr14: +#line 35 "ext/http11/http11_parser.rl" {MARK(mark, p); } goto st2; st2: if ( ++p == pe ) goto _out2; case 2: -#line 95 "ext/http11/http11_parser.c" +#line 114 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr12; - case 36: goto st35; - case 95: goto st35; + case 32: goto tr18; + case 36: goto st32; + case 95: goto st32; } if ( (*p) < 48 ) { if ( 45 <= (*p) && (*p) <= 46 ) - goto st35; + goto st32; } else if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 90 ) - goto st35; + goto st32; } else - goto st35; + goto st32; goto st1; -tr12: -#line 29 "ext/http11/http11_parser.rl" +tr18: +#line 48 "ext/http11/http11_parser.rl" { if(parser->request_method != NULL) parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p)); @@ -117,79 +136,43 @@ st3: if ( ++p == pe ) goto _out3; case 3: -#line 121 "ext/http11/http11_parser.c" +#line 140 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr21; - case 37: goto tr33; - case 43: goto tr34; - case 58: goto tr35; - case 60: goto st1; - case 62: goto st1; - case 63: goto tr36; - case 127: goto st1; + case 42: goto tr10; + case 43: goto tr11; + case 47: goto tr12; + case 58: goto tr13; } - if ( (*p) < 45 ) { - if ( (*p) > 31 ) { - if ( 34 <= (*p) && (*p) <= 35 ) - goto st1; - } else if ( (*p) >= 0 ) - goto st1; - } else if ( (*p) > 46 ) { - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto tr34; - } else if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto tr34; - } else - goto tr34; + if ( (*p) < 65 ) { + if ( 45 <= (*p) && (*p) <= 57 ) + goto tr11; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr11; } else - goto tr34; - goto tr32; -tr32: -#line 16 "ext/http11/http11_parser.rl" + goto tr11; + goto st1; +tr10: +#line 35 "ext/http11/http11_parser.rl" {MARK(mark, p); } goto st4; st4: if ( ++p == pe ) goto _out4; case 4: -#line 158 "ext/http11/http11_parser.c" - switch( (*p) ) { - case 32: goto tr21; - case 37: goto st21; - case 60: goto st1; - case 62: goto st1; - case 63: goto tr23; - case 127: goto st1; - } - if ( (*p) > 31 ) { - if ( 34 <= (*p) && (*p) <= 35 ) - goto st1; - } else if ( (*p) >= 0 ) - goto st1; - goto st4; -tr21: -#line 33 "ext/http11/http11_parser.rl" +#line 164 "ext/http11/http11_parser.c" + if ( (*p) == 32 ) + goto tr20; + goto st1; +tr20: +#line 52 "ext/http11/http11_parser.rl" { if(parser->request_uri != NULL) parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); } goto st5; -tr25: -#line 37 "ext/http11/http11_parser.rl" - { - if(parser->query_string != NULL) - parser->query_string(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st5; -tr28: -#line 33 "ext/http11/http11_parser.rl" - { - if(parser->request_uri != NULL) - parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); - } -#line 37 "ext/http11/http11_parser.rl" +tr32: +#line 56 "ext/http11/http11_parser.rl" { if(parser->query_string != NULL) parser->query_string(parser->data, PTR_TO(mark), LEN(mark, p)); @@ -199,19 +182,19 @@ st5: if ( ++p == pe ) goto _out5; case 5: -#line 203 "ext/http11/http11_parser.c" +#line 186 "ext/http11/http11_parser.c" if ( (*p) == 72 ) goto tr3; goto st1; tr3: -#line 16 "ext/http11/http11_parser.rl" +#line 35 "ext/http11/http11_parser.rl" {MARK(mark, p); } goto st6; st6: if ( ++p == pe ) goto _out6; case 6: -#line 215 "ext/http11/http11_parser.c" +#line 198 "ext/http11/http11_parser.c" if ( (*p) == 84 ) goto st7; goto st1; @@ -264,19 +247,19 @@ st13: goto _out13; case 13: if ( (*p) == 13 ) - goto tr16; + goto tr23; if ( 48 <= (*p) && (*p) <= 57 ) goto st13; goto st1; -tr16: -#line 42 "ext/http11/http11_parser.rl" +tr23: +#line 61 "ext/http11/http11_parser.rl" { if(parser->http_version != NULL) parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p)); } goto st14; -tr31: -#line 24 "ext/http11/http11_parser.rl" +tr35: +#line 43 "ext/http11/http11_parser.rl" { if(parser->http_field != NULL) { parser->http_field(parser->data, PTR_TO(field_start), parser->field_len, PTR_TO(mark), LEN(mark, p)); @@ -287,7 +270,7 @@ st14: if ( ++p == pe ) goto _out14; case 14: -#line 291 "ext/http11/http11_parser.c" +#line 274 "ext/http11/http11_parser.c" if ( (*p) == 10 ) goto st15; goto st1; @@ -297,62 +280,62 @@ st15: case 15: switch( (*p) ) { case 13: goto st16; - case 33: goto tr15; - case 124: goto tr15; - case 126: goto tr15; + case 33: goto tr22; + case 124: goto tr22; + case 126: goto tr22; } if ( (*p) < 45 ) { if ( (*p) > 39 ) { if ( 42 <= (*p) && (*p) <= 43 ) - goto tr15; + goto tr22; } else if ( (*p) >= 35 ) - goto tr15; + goto tr22; } else if ( (*p) > 46 ) { if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr15; + goto tr22; } else if ( (*p) > 90 ) { if ( 94 <= (*p) && (*p) <= 122 ) - goto tr15; + goto tr22; } else - goto tr15; + goto tr22; } else - goto tr15; + goto tr22; goto st1; st16: if ( ++p == pe ) goto _out16; case 16: if ( (*p) == 10 ) - goto tr19; + goto tr26; goto st1; -tr19: -#line 47 "ext/http11/http11_parser.rl" +tr26: +#line 66 "ext/http11/http11_parser.rl" { parser->body_start = p - buffer + 1; if(parser->header_done != NULL) parser->header_done(parser->data, p, 0); - goto _out54; + goto _out51; } - goto st54; -st54: + goto st51; +st51: if ( ++p == pe ) - goto _out54; -case 54: -#line 343 "ext/http11/http11_parser.c" + goto _out51; +case 51: +#line 326 "ext/http11/http11_parser.c" goto st1; -tr15: -#line 18 "ext/http11/http11_parser.rl" +tr22: +#line 37 "ext/http11/http11_parser.rl" { MARK(field_start, p); } goto st17; st17: if ( ++p == pe ) goto _out17; case 17: -#line 353 "ext/http11/http11_parser.c" +#line 336 "ext/http11/http11_parser.c" switch( (*p) ) { case 33: goto st17; - case 58: goto tr10; + case 58: goto tr16; case 124: goto st17; case 126: goto st17; } @@ -374,8 +357,8 @@ case 17: } else goto st17; goto st1; -tr10: -#line 19 "ext/http11/http11_parser.rl" +tr16: +#line 38 "ext/http11/http11_parser.rl" { parser->field_len = LEN(field_start, p); } @@ -384,7 +367,7 @@ st18: if ( ++p == pe ) goto _out18; case 18: -#line 388 "ext/http11/http11_parser.c" +#line 371 "ext/http11/http11_parser.c" if ( (*p) == 32 ) goto st19; goto st1; @@ -393,75 +376,57 @@ st19: goto _out19; case 19: if ( (*p) == 13 ) - goto tr31; - goto tr41; -tr41: -#line 23 "ext/http11/http11_parser.rl" + goto tr35; + goto tr38; +tr38: +#line 42 "ext/http11/http11_parser.rl" { MARK(mark, p); } goto st20; st20: if ( ++p == pe ) goto _out20; case 20: -#line 407 "ext/http11/http11_parser.c" +#line 390 "ext/http11/http11_parser.c" if ( (*p) == 13 ) - goto tr31; + goto tr35; goto st20; -tr33: -#line 16 "ext/http11/http11_parser.rl" +tr11: +#line 35 "ext/http11/http11_parser.rl" {MARK(mark, p); } goto st21; st21: if ( ++p == pe ) goto _out21; case 21: -#line 419 "ext/http11/http11_parser.c" - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st22; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st22; +#line 402 "ext/http11/http11_parser.c" + switch( (*p) ) { + case 43: goto st21; + case 58: goto st22; + } + if ( (*p) < 48 ) { + if ( 45 <= (*p) && (*p) <= 46 ) + goto st21; + } else if ( (*p) > 57 ) { + if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto st21; + } else if ( (*p) >= 65 ) + goto st21; } else - goto st22; + goto st21; goto st1; +tr13: +#line 35 "ext/http11/http11_parser.rl" + {MARK(mark, p); } + goto st22; st22: if ( ++p == pe ) goto _out22; case 22: - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st4; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st4; - } else - goto st4; - goto st1; -tr23: -#line 33 "ext/http11/http11_parser.rl" - { - if(parser->request_uri != NULL) - parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st23; -tr36: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } -#line 33 "ext/http11/http11_parser.rl" - { - if(parser->request_uri != NULL) - parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st23; -st23: - if ( ++p == pe ) - goto _out23; -case 23: -#line 462 "ext/http11/http11_parser.c" +#line 427 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr25; - case 37: goto tr38; + case 32: goto tr20; + case 37: goto st23; case 60: goto st1; case 62: goto st1; case 127: goto st1; @@ -471,21 +436,48 @@ case 23: goto st1; } else if ( (*p) >= 0 ) goto st1; - goto tr37; -tr37: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } - goto st24; + goto st22; +st23: + if ( ++p == pe ) + goto _out23; +case 23: + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st24; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st24; + } else + goto st24; + goto st1; st24: if ( ++p == pe ) goto _out24; case 24: -#line 484 "ext/http11/http11_parser.c" + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st22; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st22; + } else + goto st22; + goto st1; +tr12: +#line 35 "ext/http11/http11_parser.rl" + {MARK(mark, p); } + goto st25; +st25: + if ( ++p == pe ) + goto _out25; +case 25: +#line 475 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr25; - case 37: goto st25; + case 32: goto tr20; + case 37: goto st26; case 60: goto st1; case 62: goto st1; + case 63: goto tr30; case 127: goto st1; } if ( (*p) > 31 ) { @@ -493,90 +485,50 @@ case 24: goto st1; } else if ( (*p) >= 0 ) goto st1; - goto st24; -tr38: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } goto st25; -st25: - if ( ++p == pe ) - goto _out25; -case 25: -#line 506 "ext/http11/http11_parser.c" - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st26; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st26; - } else - goto st26; - goto st1; st26: if ( ++p == pe ) goto _out26; case 26: if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st24; + goto st27; } else if ( (*p) > 70 ) { if ( 97 <= (*p) && (*p) <= 102 ) - goto st24; + goto st27; } else - goto st24; + goto st27; goto st1; -tr34: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } - goto st27; st27: if ( ++p == pe ) goto _out27; case 27: -#line 537 "ext/http11/http11_parser.c" - switch( (*p) ) { - case 32: goto tr21; - case 37: goto st21; - case 43: goto st27; - case 58: goto st28; - case 60: goto st1; - case 62: goto st1; - case 63: goto tr23; - case 127: goto st1; - } - if ( (*p) < 45 ) { - if ( (*p) > 31 ) { - if ( 34 <= (*p) && (*p) <= 35 ) - goto st1; - } else if ( (*p) >= 0 ) - goto st1; - } else if ( (*p) > 46 ) { - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st27; - } else if ( (*p) > 90 ) { - if ( 97 <= (*p) && (*p) <= 122 ) - goto st27; - } else - goto st27; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st25; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st25; } else - goto st27; - goto st4; -tr35: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } + goto st25; + goto st1; +tr30: +#line 52 "ext/http11/http11_parser.rl" + { + if(parser->request_uri != NULL) + parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); + } goto st28; st28: if ( ++p == pe ) goto _out28; case 28: -#line 574 "ext/http11/http11_parser.c" +#line 527 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr21; - case 37: goto st29; + case 32: goto tr32; + case 37: goto tr37; case 60: goto st1; case 62: goto st1; - case 63: goto tr46; case 127: goto st1; } if ( (*p) > 31 ) { @@ -584,94 +536,92 @@ case 28: goto st1; } else if ( (*p) >= 0 ) goto st1; - goto st28; + goto tr36; +tr36: +#line 35 "ext/http11/http11_parser.rl" + {MARK(mark, p); } + goto st29; st29: if ( ++p == pe ) goto _out29; case 29: - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st30; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st30; - } else - goto st30; - goto st1; +#line 549 "ext/http11/http11_parser.c" + switch( (*p) ) { + case 32: goto tr32; + case 37: goto st30; + case 60: goto st1; + case 62: goto st1; + case 127: goto st1; + } + if ( (*p) > 31 ) { + if ( 34 <= (*p) && (*p) <= 35 ) + goto st1; + } else if ( (*p) >= 0 ) + goto st1; + goto st29; +tr37: +#line 35 "ext/http11/http11_parser.rl" + {MARK(mark, p); } + goto st30; st30: if ( ++p == pe ) goto _out30; case 30: +#line 571 "ext/http11/http11_parser.c" if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st28; + goto st31; } else if ( (*p) > 70 ) { if ( 97 <= (*p) && (*p) <= 102 ) - goto st28; + goto st31; } else - goto st28; + goto st31; goto st1; -tr46: -#line 33 "ext/http11/http11_parser.rl" - { - if(parser->request_uri != NULL) - parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p)); - } - goto st31; st31: if ( ++p == pe ) goto _out31; case 31: -#line 626 "ext/http11/http11_parser.c" - switch( (*p) ) { - case 32: goto tr28; - case 37: goto tr40; - case 60: goto st1; - case 62: goto st1; - case 127: goto st1; - } - if ( (*p) > 31 ) { - if ( 34 <= (*p) && (*p) <= 35 ) - goto st1; - } else if ( (*p) >= 0 ) - goto st1; - goto tr39; -tr39: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } - goto st32; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st29; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st29; + } else + goto st29; + goto st1; st32: if ( ++p == pe ) goto _out32; case 32: -#line 648 "ext/http11/http11_parser.c" switch( (*p) ) { - case 32: goto tr28; - case 37: goto st33; - case 60: goto st1; - case 62: goto st1; - case 127: goto st1; + case 32: goto tr18; + case 36: goto st33; + case 95: goto st33; } - if ( (*p) > 31 ) { - if ( 34 <= (*p) && (*p) <= 35 ) - goto st1; - } else if ( (*p) >= 0 ) - goto st1; - goto st32; -tr40: -#line 16 "ext/http11/http11_parser.rl" - {MARK(mark, p); } - goto st33; + if ( (*p) < 48 ) { + if ( 45 <= (*p) && (*p) <= 46 ) + goto st33; + } else if ( (*p) > 57 ) { + if ( 65 <= (*p) && (*p) <= 90 ) + goto st33; + } else + goto st33; + goto st1; st33: if ( ++p == pe ) goto _out33; case 33: -#line 670 "ext/http11/http11_parser.c" - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) + switch( (*p) ) { + case 32: goto tr18; + case 36: goto st34; + case 95: goto st34; + } + if ( (*p) < 48 ) { + if ( 45 <= (*p) && (*p) <= 46 ) goto st34; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) + } else if ( (*p) > 57 ) { + if ( 65 <= (*p) && (*p) <= 90 ) goto st34; } else goto st34; @@ -680,21 +630,26 @@ st34: if ( ++p == pe ) goto _out34; case 34: - if ( (*p) < 65 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto st32; - } else if ( (*p) > 70 ) { - if ( 97 <= (*p) && (*p) <= 102 ) - goto st32; + switch( (*p) ) { + case 32: goto tr18; + case 36: goto st35; + case 95: goto st35; + } + if ( (*p) < 48 ) { + if ( 45 <= (*p) && (*p) <= 46 ) + goto st35; + } else if ( (*p) > 57 ) { + if ( 65 <= (*p) && (*p) <= 90 ) + goto st35; } else - goto st32; + goto st35; goto st1; st35: if ( ++p == pe ) goto _out35; case 35: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st36; case 95: goto st36; } @@ -712,7 +667,7 @@ st36: goto _out36; case 36: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st37; case 95: goto st37; } @@ -730,7 +685,7 @@ st37: goto _out37; case 37: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st38; case 95: goto st38; } @@ -748,7 +703,7 @@ st38: goto _out38; case 38: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st39; case 95: goto st39; } @@ -766,7 +721,7 @@ st39: goto _out39; case 39: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st40; case 95: goto st40; } @@ -784,7 +739,7 @@ st40: goto _out40; case 40: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st41; case 95: goto st41; } @@ -802,7 +757,7 @@ st41: goto _out41; case 41: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st42; case 95: goto st42; } @@ -820,7 +775,7 @@ st42: goto _out42; case 42: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st43; case 95: goto st43; } @@ -838,7 +793,7 @@ st43: goto _out43; case 43: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st44; case 95: goto st44; } @@ -856,7 +811,7 @@ st44: goto _out44; case 44: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st45; case 95: goto st45; } @@ -874,7 +829,7 @@ st45: goto _out45; case 45: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st46; case 95: goto st46; } @@ -892,7 +847,7 @@ st46: goto _out46; case 46: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st47; case 95: goto st47; } @@ -910,7 +865,7 @@ st47: goto _out47; case 47: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st48; case 95: goto st48; } @@ -928,7 +883,7 @@ st48: goto _out48; case 48: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st49; case 95: goto st49; } @@ -946,7 +901,7 @@ st49: goto _out49; case 49: switch( (*p) ) { - case 32: goto tr12; + case 32: goto tr18; case 36: goto st50; case 95: goto st50; } @@ -963,62 +918,8 @@ st50: if ( ++p == pe ) goto _out50; case 50: - switch( (*p) ) { - case 32: goto tr12; - case 36: goto st51; - case 95: goto st51; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st51; - } else if ( (*p) > 57 ) { - if ( 65 <= (*p) && (*p) <= 90 ) - goto st51; - } else - goto st51; - goto st1; -st51: - if ( ++p == pe ) - goto _out51; -case 51: - switch( (*p) ) { - case 32: goto tr12; - case 36: goto st52; - case 95: goto st52; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st52; - } else if ( (*p) > 57 ) { - if ( 65 <= (*p) && (*p) <= 90 ) - goto st52; - } else - goto st52; - goto st1; -st52: - if ( ++p == pe ) - goto _out52; -case 52: - switch( (*p) ) { - case 32: goto tr12; - case 36: goto st53; - case 95: goto st53; - } - if ( (*p) < 48 ) { - if ( 45 <= (*p) && (*p) <= 46 ) - goto st53; - } else if ( (*p) > 57 ) { - if ( 65 <= (*p) && (*p) <= 90 ) - goto st53; - } else - goto st53; - goto st1; -st53: - if ( ++p == pe ) - goto _out53; -case 53: if ( (*p) == 32 ) - goto tr12; + goto tr18; goto st1; } _out1: cs = 1; goto _out; @@ -1037,7 +938,7 @@ case 53: _out14: cs = 14; goto _out; _out15: cs = 15; goto _out; _out16: cs = 16; goto _out; - _out54: cs = 54; goto _out; + _out51: cs = 51; goto _out; _out17: cs = 17; goto _out; _out18: cs = 18; goto _out; _out19: cs = 19; goto _out; @@ -1072,13 +973,10 @@ case 53: _out48: cs = 48; goto _out; _out49: cs = 49; goto _out; _out50: cs = 50; goto _out; - _out51: cs = 51; goto _out; - _out52: cs = 52; goto _out; - _out53: cs = 53; goto _out; _out: {} } -#line 137 "ext/http11/http11_parser.rl" +#line 156 "ext/http11/http11_parser.rl" parser->cs = cs; parser->nread += p - (buffer + off); @@ -1093,8 +991,8 @@ case 53: if(parser->body_start) { /* final \r\n combo encountered so stop right here */ -#line 1097 "ext/http11/http11_parser.c" -#line 151 "ext/http11/http11_parser.rl" +#line 995 "ext/http11/http11_parser.c" +#line 170 "ext/http11/http11_parser.rl" parser->nread++; } @@ -1106,8 +1004,8 @@ int http_parser_finish(http_parser *parser) int cs = parser->cs; -#line 1110 "ext/http11/http11_parser.c" -#line 162 "ext/http11/http11_parser.rl" +#line 1008 "ext/http11/http11_parser.c" +#line 181 "ext/http11/http11_parser.rl" parser->cs = cs; diff --git a/ext/http11/http11_parser.h b/ext/http11/http11_parser.h index bcf759e..7bab703 100644 --- a/ext/http11/http11_parser.h +++ b/ext/http11/http11_parser.h @@ -1,3 +1,22 @@ +/* Mongrel Web Server - A Mostly Ruby Webserver and Library + * + * Copyright (C) 2005 Zed A. Shaw zedshaw AT zedshaw dot com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef http11_parser_h #define http11_parser_h diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl index 0bc59ef..37a3023 100644 --- a/ext/http11/http11_parser.rl +++ b/ext/http11/http11_parser.rl @@ -1,3 +1,22 @@ +/* Mongrel Web Server - A Mostly Ruby Webserver and Library + * + * Copyright (C) 2005 Zed A. Shaw zedshaw AT zedshaw dot com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "http11_parser.h" #include #include -- cgit v1.2.3-24-ge0c7