diff options
author | Eric Wong <bofh@yhbt.net> | 2021-10-22 09:58:41 +0000 |
---|---|---|
committer | Eric Wong <bofh@yhbt.net> | 2021-10-25 04:05:28 +0000 |
commit | 0af6e2d0c8fbb606db58b213ff4d0d28a1e38f4e (patch) | |
tree | 73757c5fe4da15c9ff16849452049ae7c990b808 /test/unit | |
parent | d60372b5c3ba517f1015b93912824e0675a4326d (diff) | |
download | unicorn-pico.tar.gz |
This should open the door for us to process chunked data faster by modifying the buffer in-place rather than copying to a destination buffer.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/test_http_parser.rb | 2 | ||||
-rw-r--r-- | test/unit/test_http_parser_ng.rb | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 697af44..68d48b8 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -859,7 +859,7 @@ class HttpParserTest < Test::Unit::TestCase # need to update this when 128-bit machines come out # n.b. actual struct size on 64-bit is 56 bytes + 40 bytes for RVALUE # Ruby <= 2.2 objspace did not count the 40-byte RVALUE, 2.3 does. - assert_operator n, :<=, 96 + assert_operator n, :<=, 104 # TODO: drop to <= 96 assert_operator n, :>, 0 end rescue LoadError diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index 425d5ad..40fe2e3 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -230,8 +230,10 @@ class HttpParserNgTest < Test::Unit::TestCase tmp = "" assert_nil @parser.filter_body(tmp, str << "..") assert_equal "..", tmp - assert_nil @parser.filter_body(tmp, str << "abcd\r\n0\r\n") + assert_nil @parser.filter_body(tmp, str << "abcd") assert_equal "abcd", tmp + @parser.filter_body(tmp, str << "\r\n0\r\n") + assert_equal "", tmp assert_equal str.object_id, @parser.filter_body(tmp, str << "PUT").object_id assert_equal "PUT", str assert ! @parser.keepalive? @@ -318,7 +320,7 @@ class HttpParserNgTest < Test::Unit::TestCase "1\r\na\r\n2\r\n..\r\n0\r\n" assert_equal req, @parser.parse tmp = '' - assert_nil @parser.filter_body(tmp, str) + @parser.filter_body(tmp, str) assert_equal 'a..', tmp rv = @parser.filter_body(tmp, str) assert_equal rv.object_id, str.object_id @@ -357,7 +359,8 @@ class HttpParserNgTest < Test::Unit::TestCase assert_equal 'Content-MD5', req['HTTP_TRAILER'] assert_nil req['HTTP_CONTENT_MD5'] tmp = '' - assert_nil @parser.filter_body(tmp, str) + # assert_nil @parser.filter_body(tmp, str) + @parser.filter_body(tmp, str) assert_equal 'a..', tmp md5_b64 = [ Digest::MD5.digest(tmp) ].pack('m').strip.freeze rv = @parser.filter_body(tmp, str) @@ -387,7 +390,7 @@ class HttpParserNgTest < Test::Unit::TestCase assert_equal 'Content-MD5', req['HTTP_TRAILER'] assert_nil req['HTTP_CONTENT_MD5'] tmp = '' - assert_nil @parser.filter_body(tmp, str) + @parser.filter_body(tmp, str) assert_equal 'a..', tmp md5_b64 = [ Digest::MD5.digest(tmp) ].pack('m').strip.freeze rv = @parser.filter_body(tmp, str) @@ -471,7 +474,7 @@ class HttpParserNgTest < Test::Unit::TestCase assert_equal req, @parser.parse assert_equal 'Transfer-Encoding', req['HTTP_TRAILER'] tmp = '' - assert_nil @parser.filter_body(tmp, str) + @parser.filter_body(tmp, str) assert_equal 'a..', tmp assert_equal '', str str << "Transfer-Encoding: identity\r\n\r\n" |