diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-05-07 18:20:49 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-05-07 18:28:05 +0000 |
commit | 935912a422cabfd323f9b4ff268ded09a2ebe7a6 (patch) | |
tree | 72a66d5a4cb8ca29746b81958879f15ff8f85b96 /test | |
parent | 3c6fceea7bca1932081113c516da7a94b94fe9c6 (diff) | |
download | unicorn-935912a422cabfd323f9b4ff268ded09a2ebe7a6.tar.gz |
This is allowed by RFC 2616, section 2.2, where spaces and horizontal tabs are counted as linear white space and linear white space (not just regular spaces) may prefix field-values (section 4.2). This has _not_ been a real issue in ~4 years of using this parser (starting with Mongrel) with clients in the wild. Thanks to IƱaki Baz Castillo for pointing this out.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/test_http_parser.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 5b0ca9f..b7c8a1c 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -51,6 +51,14 @@ class HttpParserTest < Test::Unit::TestCase assert parser.keepalive? end + def test_tab_lws + parser = HttpParser.new + req = {} + tmp = "GET / HTTP/1.1\r\nHost:\tfoo.bar\r\n\r\n" + assert_equal req.object_id, parser.headers(req, tmp).object_id + assert_equal "foo.bar", req['HTTP_HOST'] + end + def test_connection_close_no_ka parser = HttpParser.new req = {} |