diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-04-21 11:14:56 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-04-21 11:16:41 -0700 |
commit | 3dc43b27e2ab2740acda0514bb0d9562810b3df1 (patch) | |
tree | 944a9c5f86d5d7c876209a342932d77830cac0e0 /test/unit/test_http_parser.rb | |
parent | 3871cb11cfb68b6fa02a646caf3765e309d38494 (diff) | |
download | unicorn-3dc43b27e2ab2740acda0514bb0d9562810b3df1.tar.gz |
They aren't common, but apparently there exist URLs with them, so we'll support them.
Diffstat (limited to 'test/unit/test_http_parser.rb')
-rw-r--r-- | test/unit/test_http_parser.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index ce1213f..45e051a 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -136,6 +136,22 @@ class HttpParserTest < Test::Unit::TestCase assert_equal '', req['QUERY_STRING'] end + # not common, but underscores do appear in practice + def test_absolute_uri_underscores + parser = HttpParser.new + req = {} + http = "GET http://under_score.example.com/foo?q=bar HTTP/1.0\r\n\r\n" + assert parser.execute(req, http) + assert_equal 'http', req['rack.url_scheme'] + assert_equal '/foo?q=bar', req['REQUEST_URI'] + assert_equal '/foo', req['REQUEST_PATH'] + assert_equal 'q=bar', req['QUERY_STRING'] + + assert_equal 'under_score.example.com', req['HTTP_HOST'] + assert_equal 'under_score.example.com', req['SERVER_NAME'] + assert_equal '80', req['SERVER_PORT'] + end + def test_absolute_uri parser = HttpParser.new req = {} |