about summary refs log tree commit homepage
path: root/test/unit/test_http_parser_ng.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-04-26 15:02:46 -0700
committerEric Wong <normalperson@yhbt.net>2010-04-26 15:08:10 -0700
commitc54df54f6633f3467b64fdfc9cbff278d02397ac (patch)
tree86481f48c3f247446fe9b1ef8f1b592ba1a0728f /test/unit/test_http_parser_ng.rb
parentde0e3a2f969730f4682daf6cff1e0d424ddd43e1 (diff)
downloadunicorn-c54df54f6633f3467b64fdfc9cbff278d02397ac.tar.gz
HTTP requests without trailers still need a CRLF after the last
chunk, that is: it must end as: "0\r\n\r\n", not "0\r\n".  So
we'll always pretend there are trailers to parse for the
sake of TeeInput.

This is mostly a pedantic fix, as the two bytes in the socket
buffer are unlikely to trigger protocol errors.
Diffstat (limited to 'test/unit/test_http_parser_ng.rb')
-rw-r--r--test/unit/test_http_parser_ng.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb
index 3b9111f..7267ea0 100644
--- a/test/unit/test_http_parser_ng.rb
+++ b/test/unit/test_http_parser_ng.rb
@@ -172,6 +172,10 @@ class HttpParserNgTest < Test::Unit::TestCase
     assert_equal '', str
     assert ! @parser.body_eof?
     assert_equal "", @parser.filter_body(tmp, "\r\n0\r\n")
+    assert_equal "", tmp
+    assert @parser.body_eof?
+    assert_equal req, @parser.trailers(req, moo = "\r\n")
+    assert_equal "", moo
     assert @parser.body_eof?
     assert ! @parser.keepalive?
   end