summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-04-21 11:32:03 -0700
committerEric Wong <normalperson@yhbt.net>2009-04-21 11:32:03 -0700
commit82b4ed731fb0f739829ac03a7b1964733f8ed19c (patch)
tree02f0fcdddc54eaa15023b69f0ad835f80aacd243
parent3dc43b27e2ab2740acda0514bb0d9562810b3df1 (diff)
-rw-r--r--test/unit/test_http_parser.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb
index 45e051a..a158ebb 100644
--- a/test/unit/test_http_parser.rb
+++ b/test/unit/test_http_parser.rb
@@ -201,6 +201,22 @@ class HttpParserTest < Test::Unit::TestCase
     assert_equal '8080', req['SERVER_PORT']
   end
 
+  def test_absolute_uri_with_empty_port
+    parser = HttpParser.new
+    req = {}
+    http = "GET https://example.com:/foo?q=bar HTTP/1.1\r\n" \
+           "Host: bad.example.com\r\n\r\n"
+    assert parser.execute(req, http)
+    assert_equal 'https', 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']
+    assert_equal 'example.com', req['SERVER_NAME']
+    assert_equal '443', req['SERVER_PORT']
+  end
+
   def test_put_body_oneshot
     parser = HttpParser.new
     req = {}