1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Fix terminating a chunked encoding stream

This commit is contained in:
Evan Phoenix 2011-10-20 23:04:24 -07:00
parent be4a8336c0
commit 8ffe623bf9
2 changed files with 3 additions and 2 deletions

View file

@ -307,6 +307,7 @@ module Puma
if chunked
client.write "0"
client.write line_ending
client.write line_ending
client.flush
end

View file

@ -56,7 +56,7 @@ class TestPersistent < Test::Unit::TestCase
@client << @valid_request
assert_equal "HTTP/1.1 200 OK\r\nX-Header: Works\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nHello\r\n7\r\nChunked\r\n0\r\n", lines(9)
assert_equal "HTTP/1.1 200 OK\r\nX-Header: Works\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nHello\r\n7\r\nChunked\r\n0\r\n\r\n", lines(10)
end
def test_no_chunked_in_http10
@ -74,7 +74,7 @@ class TestPersistent < Test::Unit::TestCase
@client << @valid_request
assert_equal "HTTP/1.1 200 OK\r\nX-Header: Works\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nHello\r\n#{str.size.to_s(16)}\r\n#{str}\r\n0\r\n", lines(9)
assert_equal "HTTP/1.1 200 OK\r\nX-Header: Works\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nHello\r\n#{str.size.to_s(16)}\r\n#{str}\r\n0\r\n\r\n", lines(10)
end