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

Keep the encoding of the body correct. Fixes #79

This commit is contained in:
Evan Phoenix 2012-04-28 09:51:08 -07:00
parent d8c5a0bda3
commit 6d0abe5fd7
2 changed files with 21 additions and 3 deletions

View file

@ -568,12 +568,11 @@ module Puma
if remain > MAX_BODY
stream = Tempfile.new(Const::PUMA_TMP_BASE)
stream.binmode
stream.write body
else
stream = StringIO.new
stream = StringIO.new body
end
stream.write body
# Read an odd sized chunk so we can read even sized ones
# after this
chunk = client.readpartial(remain % CHUNK_SIZE)

View file

@ -75,6 +75,24 @@ class TestRackServer < Test::Unit::TestCase
end
end
def test_large_post_body
@checker = ErrorChecker.new ServerLint.new(@simple)
@server.app = @checker
@server.run
big = "x" * (1024 * 16)
Net::HTTP.post_form URI.parse('http://localhost:9998/test'),
{ "big" => big }
stop
if exc = @checker.exception
raise exc
end
end
def test_path_info
input = nil
@server.app = lambda { |env| input = env; @simple.call(env) }
@ -119,4 +137,5 @@ class TestRackServer < Test::Unit::TestCase
assert_match %r!GET /test HTTP/1\.1!, log.string
end
end