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

Fix decoding the chunked body.

This commit is contained in:
Ralf Kistner 2020-07-30 16:07:55 +02:00 committed by Nate Berkopec
parent 552e8b5546
commit a2f5199151
No known key found for this signature in database
GPG key ID: BDD7A4B8E43906A6

View file

@ -456,7 +456,15 @@ module Puma
chunk = chunk[@partial_part_left..-1] chunk = chunk[@partial_part_left..-1]
@partial_part_left = 0 @partial_part_left = 0
else else
write_chunk(chunk) if @partial_part_left > 2 # don't include the last \r\n if @partial_part_left > 2
if @partial_part_left == chunk.size + 1
# Don't include the last \r
write_chunk(chunk[0..(@partial_part_left-3)])
else
# don't include the last \r\n
write_chunk(chunk)
end
end
@partial_part_left -= chunk.size @partial_part_left -= chunk.size
return false return false
end end