about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorevanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-17 07:10:43 +0000
committerevanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-17 07:10:43 +0000
commit954d96c7e8c9ff11e886b23b6b4499387ec6f56b (patch)
tree0197e60cae707d72d1f79c0e13c59c46664eed4c /ext
parent594f6fe42cba5b21b67b3492e1835a169b5a6c1d (diff)
downloadunicorn-954d96c7e8c9ff11e886b23b6b4499387ec6f56b.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@675 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'ext')
-rw-r--r--ext/http11/http11_parser.c139
-rw-r--r--ext/http11/http11_parser.java.rl (renamed from ext/http11_java/http11_parser.rl)2
-rw-r--r--ext/http11/http11_parser.rl2
-rw-r--r--ext/http11/http11_parser_common.rl3
4 files changed, 76 insertions, 70 deletions
diff --git a/ext/http11/http11_parser.c b/ext/http11/http11_parser.c
index d099cdc..1712d29 100644
--- a/ext/http11/http11_parser.c
+++ b/ext/http11/http11_parser.c
@@ -14,29 +14,30 @@
 #define MARK(M,FPC) (parser->M = (FPC) - buffer)
 #define PTR_TO(F) (buffer + parser->F)
 
-/** machine **/
-#line 119 "http11_parser.rl"
+/** Machine **/
+
+#line 74 "http11_parser.rl"
 
 
 /** Data **/
 
-#line 24 "http11_parser.c"
+#line 25 "http11_parser.c"
 static const int http_parser_start = 1;
 static const int http_parser_first_final = 57;
 static const int http_parser_error = 0;
 
 static const int http_parser_en_main = 1;
 
-#line 123 "http11_parser.rl"
+#line 78 "http11_parser.rl"
 
 int http_parser_init(http_parser *parser)  {
   int cs = 0;
   
-#line 36 "http11_parser.c"
+#line 37 "http11_parser.c"
         {
         cs = http_parser_start;
         }
-#line 127 "http11_parser.rl"
+#line 82 "http11_parser.rl"
   parser->cs = cs;
   parser->body_start = 0;
   parser->content_len = 0;
@@ -64,7 +65,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
 
 
   
-#line 68 "http11_parser.c"
+#line 69 "http11_parser.c"
         {
         if ( p == pe )
                 goto _out;
@@ -87,14 +88,14 @@ case 1:
 st0:
         goto _out0;
 tr0:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st2;
 st2:
         if ( ++p == pe )
                 goto _out2;
 case 2:
-#line 98 "http11_parser.c"
+#line 99 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr2;
                 case 36: goto st38;
@@ -110,7 +111,7 @@ case 2:
                 goto st38;
         goto st0;
 tr2:
-#line 34 "http11_parser.rl"
+#line 36 "http11_parser.rl"
         {
     if(parser->request_method != NULL)
       parser->request_method(parser->data, PTR_TO(mark), LEN(mark, p));
@@ -120,7 +121,7 @@ st3:
         if ( ++p == pe )
                 goto _out3;
 case 3:
-#line 124 "http11_parser.c"
+#line 125 "http11_parser.c"
         switch( (*p) ) {
                 case 42: goto tr4;
                 case 43: goto tr5;
@@ -137,66 +138,66 @@ case 3:
                 goto tr5;
         goto st0;
 tr4:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st4;
 st4:
         if ( ++p == pe )
                 goto _out4;
 case 4:
-#line 148 "http11_parser.c"
+#line 149 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr8;
                 case 35: goto tr9;
         }
         goto st0;
 tr8:
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st5;
 tr30:
-#line 42 "http11_parser.rl"
+#line 44 "http11_parser.rl"
         {
     if(parser->fragment != NULL)
       parser->fragment(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st5;
 tr40:
-#line 58 "http11_parser.rl"
+#line 60 "http11_parser.rl"
         {
     if(parser->request_path != NULL)
       parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st5;
 tr51:
-#line 47 "http11_parser.rl"
+#line 49 "http11_parser.rl"
         {MARK(query_start, p); }
-#line 48 "http11_parser.rl"
+#line 50 "http11_parser.rl"
         {
     if(parser->query_string != NULL)
       parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st5;
 tr55:
-#line 48 "http11_parser.rl"
+#line 50 "http11_parser.rl"
         {
     if(parser->query_string != NULL)
       parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
@@ -206,19 +207,19 @@ st5:
         if ( ++p == pe )
                 goto _out5;
 case 5:
-#line 210 "http11_parser.c"
+#line 211 "http11_parser.c"
         if ( (*p) == 72 )
                 goto tr10;
         goto st0;
 tr10:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st6;
 st6:
         if ( ++p == pe )
                 goto _out6;
 case 6:
-#line 222 "http11_parser.c"
+#line 223 "http11_parser.c"
         if ( (*p) == 84 )
                 goto st7;
         goto st0;
@@ -276,14 +277,14 @@ case 13:
                 goto st13;
         goto st0;
 tr18:
-#line 53 "http11_parser.rl"
+#line 55 "http11_parser.rl"
         {        
     if(parser->http_version != NULL)
       parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st14;
 tr26:
-#line 29 "http11_parser.rl"
+#line 31 "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));
@@ -294,7 +295,7 @@ st14:
         if ( ++p == pe )
                 goto _out14;
 case 14:
-#line 298 "http11_parser.c"
+#line 299 "http11_parser.c"
         if ( (*p) == 10 )
                 goto st15;
         goto st0;
@@ -334,7 +335,7 @@ case 16:
                 goto tr22;
         goto st0;
 tr22:
-#line 63 "http11_parser.rl"
+#line 65 "http11_parser.rl"
         {
     parser->body_start = p - buffer + 1;
     if(parser->header_done != NULL)
@@ -346,17 +347,17 @@ st57:
         if ( ++p == pe )
                 goto _out57;
 case 57:
-#line 350 "http11_parser.c"
+#line 351 "http11_parser.c"
         goto st0;
 tr21:
-#line 23 "http11_parser.rl"
+#line 25 "http11_parser.rl"
         { MARK(field_start, p); }
         goto st17;
 st17:
         if ( ++p == pe )
                 goto _out17;
 case 17:
-#line 360 "http11_parser.c"
+#line 361 "http11_parser.c"
         switch( (*p) ) {
                 case 33: goto st17;
                 case 58: goto tr24;
@@ -382,77 +383,77 @@ case 17:
                 goto st17;
         goto st0;
 tr24:
-#line 24 "http11_parser.rl"
+#line 26 "http11_parser.rl"
         {
     parser->field_len = LEN(field_start, p);
   }
         goto st18;
 tr27:
-#line 28 "http11_parser.rl"
+#line 30 "http11_parser.rl"
         { MARK(mark, p); }
         goto st18;
 st18:
         if ( ++p == pe )
                 goto _out18;
 case 18:
-#line 399 "http11_parser.c"
+#line 400 "http11_parser.c"
         switch( (*p) ) {
                 case 13: goto tr26;
                 case 32: goto tr27;
         }
         goto tr25;
 tr25:
-#line 28 "http11_parser.rl"
+#line 30 "http11_parser.rl"
         { MARK(mark, p); }
         goto st19;
 st19:
         if ( ++p == pe )
                 goto _out19;
 case 19:
-#line 413 "http11_parser.c"
+#line 414 "http11_parser.c"
         if ( (*p) == 13 )
                 goto tr26;
         goto st19;
 tr9:
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st20;
 tr41:
-#line 58 "http11_parser.rl"
+#line 60 "http11_parser.rl"
         {
     if(parser->request_path != NULL)
       parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st20;
 tr52:
-#line 47 "http11_parser.rl"
+#line 49 "http11_parser.rl"
         {MARK(query_start, p); }
-#line 48 "http11_parser.rl"
+#line 50 "http11_parser.rl"
         {
     if(parser->query_string != NULL)
       parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
   }
         goto st20;
 tr56:
-#line 48 "http11_parser.rl"
+#line 50 "http11_parser.rl"
         {
     if(parser->query_string != NULL)
       parser->query_string(parser->data, PTR_TO(query_start), LEN(query_start, p));
   }
-#line 38 "http11_parser.rl"
+#line 40 "http11_parser.rl"
         {
     if(parser->request_uri != NULL)
       parser->request_uri(parser->data, PTR_TO(mark), LEN(mark, p));
@@ -462,7 +463,7 @@ st20:
         if ( ++p == pe )
                 goto _out20;
 case 20:
-#line 466 "http11_parser.c"
+#line 467 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr30;
                 case 37: goto tr31;
@@ -477,14 +478,14 @@ case 20:
                 goto st0;
         goto tr29;
 tr29:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st21;
 st21:
         if ( ++p == pe )
                 goto _out21;
 case 21:
-#line 488 "http11_parser.c"
+#line 489 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr30;
                 case 37: goto st22;
@@ -499,14 +500,14 @@ case 21:
                 goto st0;
         goto st21;
 tr31:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st22;
 st22:
         if ( ++p == pe )
                 goto _out22;
 case 22:
-#line 510 "http11_parser.c"
+#line 511 "http11_parser.c"
         if ( (*p) < 65 ) {
                 if ( 48 <= (*p) && (*p) <= 57 )
                         goto st23;
@@ -530,14 +531,14 @@ case 23:
                 goto st21;
         goto st0;
 tr5:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st24;
 st24:
         if ( ++p == pe )
                 goto _out24;
 case 24:
-#line 541 "http11_parser.c"
+#line 542 "http11_parser.c"
         switch( (*p) ) {
                 case 43: goto st24;
                 case 58: goto st25;
@@ -555,14 +556,14 @@ case 24:
                 goto st24;
         goto st0;
 tr7:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st25;
 st25:
         if ( ++p == pe )
                 goto _out25;
 case 25:
-#line 566 "http11_parser.c"
+#line 567 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr8;
                 case 34: goto st0;
@@ -602,14 +603,14 @@ case 27:
                 goto st25;
         goto st0;
 tr6:
-#line 20 "http11_parser.rl"
+#line 22 "http11_parser.rl"
         {MARK(mark, p); }
         goto st28;
 st28:
         if ( ++p == pe )
                 goto _out28;
 case 28:
-#line 613 "http11_parser.c"
+#line 614 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr40;
                 case 34: goto st0;
@@ -651,7 +652,7 @@ case 30:
                 goto st28;
         goto st0;
 tr43:
-#line 58 "http11_parser.rl"
+#line 60 "http11_parser.rl"
         {
     if(parser->request_path != NULL)
       parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
@@ -661,7 +662,7 @@ st31:
         if ( ++p == pe )
                 goto _out31;
 case 31:
-#line 665 "http11_parser.c"
+#line 666 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr8;
                 case 34: goto st0;
@@ -702,7 +703,7 @@ case 33:
                 goto st31;
         goto st0;
 tr44:
-#line 58 "http11_parser.rl"
+#line 60 "http11_parser.rl"
         {
     if(parser->request_path != NULL)
       parser->request_path(parser->data, PTR_TO(mark), LEN(mark,p));
@@ -712,7 +713,7 @@ st34:
         if ( ++p == pe )
                 goto _out34;
 case 34:
-#line 716 "http11_parser.c"
+#line 717 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr51;
                 case 34: goto st0;
@@ -726,14 +727,14 @@ case 34:
                 goto st0;
         goto tr50;
 tr50:
-#line 47 "http11_parser.rl"
+#line 49 "http11_parser.rl"
         {MARK(query_start, p); }
         goto st35;
 st35:
         if ( ++p == pe )
                 goto _out35;
 case 35:
-#line 737 "http11_parser.c"
+#line 738 "http11_parser.c"
         switch( (*p) ) {
                 case 32: goto tr55;
                 case 34: goto st0;
@@ -747,14 +748,14 @@ case 35:
                 goto st0;
         goto st35;
 tr53:
-#line 47 "http11_parser.rl"
+#line 49 "http11_parser.rl"
         {MARK(query_start, p); }
         goto st36;
 st36:
         if ( ++p == pe )
                 goto _out36;
 case 36:
-#line 758 "http11_parser.c"
+#line 759 "http11_parser.c"
         if ( (*p) < 65 ) {
                 if ( 48 <= (*p) && (*p) <= 57 )
                         goto st37;
@@ -1169,7 +1170,7 @@ case 56:
 
         _out: {}
         }
-#line 154 "http11_parser.rl"
+#line 109 "http11_parser.rl"
 
   parser->cs = cs;
   parser->nread += p - (buffer + off);
@@ -1184,8 +1185,8 @@ case 56:
   if(parser->body_start) {
     /* final \r\n combo encountered so stop right here */
     
-#line 1188 "http11_parser.c"
-#line 168 "http11_parser.rl"
+#line 1189 "http11_parser.c"
+#line 123 "http11_parser.rl"
     parser->nread++;
   }
 
@@ -1197,8 +1198,8 @@ int http_parser_finish(http_parser *parser)
   int cs = parser->cs;
 
   
-#line 1201 "http11_parser.c"
-#line 179 "http11_parser.rl"
+#line 1202 "http11_parser.c"
+#line 134 "http11_parser.rl"
 
   parser->cs = cs;
 
diff --git a/ext/http11_java/http11_parser.rl b/ext/http11/http11_parser.java.rl
index 0c67e92..f41c1a8 100644
--- a/ext/http11_java/http11_parser.rl
+++ b/ext/http11/http11_parser.java.rl
@@ -55,6 +55,8 @@ public class Http11Parser {
     fbreak;
   }
 
+  include http_parser_common "http11_parser_common.rl";
+
 }%%
 
 /** Data **/
diff --git a/ext/http11/http11_parser.rl b/ext/http11/http11_parser.rl
index edcf191..fffe57a 100644
--- a/ext/http11/http11_parser.rl
+++ b/ext/http11/http11_parser.rl
@@ -69,6 +69,8 @@
     fbreak;
   }
 
+  include http_parser_common "http11_parser_common.rl";
+
 }%%
 
 /** Data **/
diff --git a/ext/http11/http11_parser_common.rl b/ext/http11/http11_parser_common.rl
index 4652e33..a70d4da 100644
--- a/ext/http11/http11_parser_common.rl
+++ b/ext/http11/http11_parser_common.rl
@@ -1,6 +1,6 @@
 %%{
   
-  machine http_parser;
+  machine http_parser_common;
 
 #### HTTP PROTOCOL GRAMMAR
 # line endings
@@ -50,4 +50,5 @@
   Request = Request_Line ( message_header )* ( CRLF @done );
 
 main := Request;
+
 }%%