about summary refs log tree commit homepage
path: root/test/unit/test_http_parser.rb
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 /test/unit/test_http_parser.rb
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 'test/unit/test_http_parser.rb')
-rw-r--r--test/unit/test_http_parser.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb
index f6fdd47..37a539d 100644
--- a/test/unit/test_http_parser.rb
+++ b/test/unit/test_http_parser.rb
@@ -103,6 +103,20 @@ class HttpParserTest < Test::Unit::TestCase
     assert_nil req['QUERY_STRING']
   end
 
+  def test_absolute_uri
+    parser = HttpParser.new
+    req = {}
+    http = "GET http://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 'example.com', req['HTTP_HOST'] # TODO
+    # assert_equal 'example.com', req['SERVER_NAME'] # TODO
+  end
+
   def test_put_body_oneshot
     parser = HttpParser.new
     req = {}