diff options
Diffstat (limited to 'ext/unicorn/http11/http11_parser_common.rl')
-rw-r--r-- | ext/unicorn/http11/http11_parser_common.rl | 9 |
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; |