about summary refs log tree commit homepage
path: root/ext/unicorn/http11/http11_parser_common.rl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-04-21 11:14:39 -0700
committerEric Wong <normalperson@yhbt.net>2009-04-21 11:16:21 -0700
commited4f50016ab0eab1ebbeac2fe1d0fd8712c7ee91 (patch)
tree5c232a2f34271090ad6512d565ee2f3aee39e7af /ext/unicorn/http11/http11_parser_common.rl
parent357fb0a21fdfe6ff3af522a2463248e20b2fa8be (diff)
downloadunicorn-ed4f50016ab0eab1ebbeac2fe1d0fd8712c7ee91.tar.gz
It's part of the HTTP/1.1 (rfc2616), so we might as well
handle it in there and set PATH_INFO while we're at it.

Also, make "OPTIONS *" test not fail Rack::Lint
Diffstat (limited to 'ext/unicorn/http11/http11_parser_common.rl')
-rw-r--r--ext/unicorn/http11/http11_parser_common.rl9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/unicorn/http11/http11_parser_common.rl b/ext/unicorn/http11/http11_parser_common.rl
index ee970b1..20fef92 100644
--- a/ext/unicorn/http11/http11_parser_common.rl
+++ b/ext/unicorn/http11/http11_parser_common.rl
@@ -24,8 +24,9 @@
   token = (ascii -- (CTL | tspecials));
 
 # URI schemes and absolute paths
-  scheme = ( alpha | digit | "+" | "-" | "." )* ;
-  absolute_uri = (scheme ":" (uchar | reserved )*);
+  scheme = ( "http"i ("s"i)? ) $downcase_char;
+  hostname = (alnum | "-" | ".")+;
+  host_with_port = (hostname (":" digit*)?);
 
   path = ( pchar+ ( "/" pchar* )* ) ;
   query = ( uchar | reserved )* %query_string ;
@@ -33,8 +34,10 @@
   params = ( param ( ";" param )* ) ;
   rel_path = ( path? %request_path (";" params)? ) ("?" %start_query query)?;
   absolute_path = ( "/"+ rel_path );
+  path_uri = absolute_path > mark %request_uri;
+  Absolute_URI = (scheme "://" host_with_port path_uri);
 
-  Request_URI = ( "*" | absolute_uri | absolute_path ) >mark %request_uri;
+  Request_URI = ((absolute_path | "*") >mark %request_uri) | Absolute_URI;
   Fragment = ( uchar | reserved )* >mark %fragment;
   Method = ( upper | digit | safe ){1,20} >mark %request_method;