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:03:44 +0000
committerevanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9>2007-10-17 07:03:44 +0000
commit6d91530c8d0e35b236afb2b4a573def300cf3913 (patch)
treea2c94bc0bcd2449676bea08f05922c99c8070ba6 /ext
parenta2523523e0da79e9e5bde6d16279643e438b0e50 (diff)
downloadunicorn-6d91530c8d0e35b236afb2b4a573def300cf3913.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@673 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'ext')
-rw-r--r--ext/http11_java/http11_parser.rl101
1 files changed, 2 insertions, 99 deletions
diff --git a/ext/http11_java/http11_parser.rl b/ext/http11_java/http11_parser.rl
index 5136993..32dca11 100644
--- a/ext/http11_java/http11_parser.rl
+++ b/ext/http11_java/http11_parser.rl
@@ -3,105 +3,8 @@ package org.jruby.mongrel;
 import org.jruby.util.ByteList;
 
 public class Http11Parser {
-
-/** machine **/
-%%{
-  machine http_parser;
-
-  action mark {parser.mark = fpc; }
-
-  action start_field { parser.field_start = fpc; }
-  action write_field {
-    parser.field_len = fpc-parser.field_start;
-  }
-
-  action start_value { parser.mark = fpc; }
-  action write_value {
-    if(parser.http_field != null) {
-      parser.http_field.call(parser.data, parser.field_start, parser.field_len, parser.mark, fpc-parser.mark);
-    }
-  }
-  action request_method {
-    if(parser.request_method != null)
-      parser.request_method.call(parser.data, parser.mark, fpc-parser.mark);
-  }
-  action request_uri {
-    if(parser.request_uri != null)
-      parser.request_uri.call(parser.data, parser.mark, fpc-parser.mark);
-  }
-
-  action start_query {parser.query_start = fpc; }
-  action query_string {
-    if(parser.query_string != null)
-      parser.query_string.call(parser.data, parser.query_start, fpc-parser.query_start);
-  }
-
-  action http_version {        
-    if(parser.http_version != null)
-      parser.http_version.call(parser.data, parser.mark, fpc-parser.mark);
-  }
-
-  action request_path {
-    if(parser.request_path != null)
-      parser.request_path.call(parser.data, parser.mark, fpc-parser.mark);
-  }
-
-  action done {
-    parser.body_start = fpc + 1;
-    if(parser.header_done != null)
-      parser.header_done.call(parser.data, fpc + 1, pe - fpc - 1);
-    fbreak;
-  }
-
-
-#### HTTP PROTOCOL GRAMMAR
-# line endings
-  CRLF = "\r\n";
-
-# character types
-  CTL = (cntrl | 127);
-  safe = ("$" | "-" | "_" | ".");
-  extra = ("!" | "*" | "'" | "(" | ")" | ",");
-  reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+");
-  unsafe = (CTL | " " | "\"" | "#" | "%" | "<" | ">");
-  national = any -- (alpha | digit | reserved | extra | safe | unsafe);
-  unreserved = (alpha | digit | safe | extra | national);
-  escape = ("%" xdigit xdigit);
-  uchar = (unreserved | escape);
-  pchar = (uchar | ":" | "@" | "&" | "=" | "+");
-  tspecials = ("(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\\" | "\"" | "/" | "[" | "]" | "?" | "=" | "{" | "}" | " " | "\t");
-
-# elements
-  token = (ascii -- (CTL | tspecials));
-
-# URI schemes and absolute paths
-  scheme = ( alpha | digit | "+" | "-" | "." )* ;
-  absolute_uri = (scheme ":" (uchar | reserved )*);
-
-  path = (pchar+ ( "/" pchar* )*) ;
-  query = ( uchar | reserved )* %query_string ;
-  param = ( pchar | "/" )* ;
-  params = (param ( ";" param )*) ;
-  rel_path = (path? %request_path (";" params)?) ("?" %start_query query)?;
-  absolute_path = ("/"+ rel_path);
-
-  Request_URI = ("*" | absolute_uri | absolute_path) >mark %request_uri;
-  Method = (upper | digit | safe){1,20} >mark %request_method;
-
-  http_number = (digit+ "." digit+) ;
-  HTTP_Version = ("HTTP/" http_number) >mark %http_version ;
-  Request_Line = (Method " " Request_URI " " HTTP_Version CRLF) ;
-
-  field_name = (token -- ":")+ >start_field %write_field;
-
-  field_value = any* >start_value %write_value;
-
-  message_header = field_name ":" " "* field_value :> CRLF;
-
-  Request = Request_Line (message_header)* ( CRLF @done);
-
-main := Request;
-}%%
+  
+/** Machine **/
 
 /** Data **/
 %% write data;