diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-09-01 19:31:30 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-09-01 19:31:30 -0700 |
commit | 40fcf09b1c2fdd87be199bc7b68a28ae538fae3f (patch) | |
tree | d5d024459b9ad7a39caa8e5e6c3d9f95518b575d /test | |
parent | d48ab6552b42fcdd70de1c6acd09312461edf705 (diff) | |
download | unicorn-40fcf09b1c2fdd87be199bc7b68a28ae538fae3f.tar.gz |
HTTP/0.9 only supports GET requests and didn't require a version number in the request line. Additionally, only a single CRLF was required. Note: we don't correctly generate HTTP/0.9 responses, yet.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/test_http_parser_ng.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index bacf2cf..d9ee9d2 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -281,4 +281,23 @@ class HttpParserNgTest < Test::Unit::TestCase assert ! @parser.keepalive? end + def test_parse_simple_request + parser = HttpParser.new + req = {} + http = "GET /read-rfc1945-if-you-dont-believe-me\r\n" + assert_equal req, parser.headers(req, http) + assert_equal '', http + expect = { + "SERVER_NAME"=>"localhost", + "rack.url_scheme"=>"http", + "REQUEST_PATH"=>"/read-rfc1945-if-you-dont-believe-me", + "PATH_INFO"=>"/read-rfc1945-if-you-dont-believe-me", + "REQUEST_URI"=>"/read-rfc1945-if-you-dont-believe-me", + "SERVER_PORT"=>"80", + "REQUEST_METHOD"=>"GET", + "QUERY_STRING"=>"" + } + assert_equal expect, req + end + end |