From c54df54f6633f3467b64fdfc9cbff278d02397ac Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 26 Apr 2010 15:02:46 -0700 Subject: http: pedantic fix for trailer-less chunked requests 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. --- test/unit/test_http_parser_ng.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/unit/test_http_parser_ng.rb') 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 -- cgit v1.2.3-24-ge0c7