Permalink
Browse files

use http_parser.rb instead of own

  • Loading branch information...
1 parent 45a58c6 commit 1e8ae5e53f58b75e684f67a19f624277d0d77498 @igrigorik igrigorik committed Feb 4, 2011
View
@@ -1,17 +1,3 @@
-source :rubygems
+source "http://rubygems.org"
-gem "async-rack"
-
-gem "rack"
-gem "rack-contrib"
-gem "rack-respond_to"
-
-gem "eventmachine"
-gem "em-synchrony"
-
-gem "log4r"
-gem "yajl-ruby"
-gem "query_string_parser"
-
-gem "rspec"
-gem "nokogiri"
+gemspec
View
@@ -1,3 +1,18 @@
+PATH
+ remote: .
+ specs:
+ goliath (0.0.1)
+ async-rack
+ em-synchrony
+ eventmachine (>= 0.12)
+ http_parser.rb
+ log4r
+ query_string_parser
+ rack
+ rack-contrib
+ rack-respond_to
+ yajl-ruby
+
GEM
remote: http://rubygems.org/
specs:
@@ -7,6 +22,7 @@ GEM
em-synchrony (0.2.0)
eventmachine (>= 0.12.9)
eventmachine (0.12.10)
+ http_parser.rb (0.5.1)
log4r (1.1.9)
nokogiri (1.4.4)
query_string_parser (0.1.1)
@@ -24,15 +40,17 @@ GEM
rspec-expectations (2.4.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.4.0)
- yajl-ruby (0.7.8)
+ yajl-ruby (0.7.9)
PLATFORMS
ruby
DEPENDENCIES
async-rack
em-synchrony
- eventmachine
+ eventmachine (>= 0.12)
+ goliath!
+ http_parser.rb
log4r
nokogiri
query_string_parser
View
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
-require 'rubygems'
-require 'goliath'
+# require 'rubygems'
+require 'lib/goliath'
class Echo < Goliath::API
def middleware
@@ -1,55 +0,0 @@
-%%{
-
- machine http_parser_common;
-
-#### HTTP PROTOCOL GRAMMAR
-# line endings
- CRLF = "\r\n";
-
-# character types
- CTL = (cntrl | 127);
- safe = ("$" | "-" | "_" | ".");
- extra = ("!" | "*" | "'" | "(" | ")" | ",");
- reserved = (";" | "/" | "?" | ":" | "@" | "&" | "=" | "+");
- sorta_safe = ("\"" | "<" | ">");
- unsafe = (CTL | " " | "#" | "%" | sorta_safe);
- national = any -- (alpha | digit | reserved | extra | safe | unsafe);
- unreserved = (alpha | digit | safe | extra | national);
- escape = ("%" xdigit xdigit);
- uchar = (unreserved | escape | sorta_safe);
- 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? (";" params)? %request_path) ("?" %start_query query)?;
- absolute_path = ( "/"+ rel_path );
-
- Request_URI = ( "*" | absolute_uri | absolute_path ) >mark %request_uri;
- Fragment = ( uchar | reserved )* >mark %fragment;
- 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 ("#" Fragment){0,1} " " 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;
-
-}%%
@@ -1,14 +0,0 @@
-#ifndef ext_help_h
-#define ext_help_h
-
-#define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "NULL found for " # T " when shouldn't be.");
-#define DATA_GET(from,type,name) Data_Get_Struct(from,type,name); RAISE_NOT_NULL(name);
-#define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "Wrong argument type for " # V " required " # T);
-
-#ifdef DEBUG
-#define TRACE() fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
-#else
-#define TRACE()
-#endif
-
-#endif
@@ -1,6 +0,0 @@
-require 'mkmf'
-
-dir_config("goliath_parser")
-have_library("c", "main")
-
-create_makefile("goliath_parser")
Oops, something went wrong. Retry.

0 comments on commit 1e8ae5e

Please sign in to comment.