tee_input: fix accounting error on corked requests
commit3b2fc62dadd3c90038c168849b33c4ca6df058da
authorEric Wong <normalperson@yhbt.net>
Wed, 8 Dec 2010 22:02:45 +0000 (8 22:02 +0000)
committerEric Wong <normalperson@yhbt.net>
Wed, 8 Dec 2010 22:34:37 +0000 (9 06:34 +0800)
tree2724ad66053bd63b433c69b3b7bf8821351f71eb
parent52f55529293e466a77090691d1fe06a7933c74a1
tee_input: fix accounting error on corked requests

In case a request sends the header and buffer as one packet,
TeeInput relying on accounting info from StreamInput is harmful
as StreamInput will buffer in memory outside of TeeInput's
control.

This bug is triggered by calling env["rack.input"].size or
env["rack.input"].rewind before to read.
lib/unicorn/tee_input.rb
t/rack-input-tests.ru [new file with mode: 0644]
t/t0100-rack-input-tests.sh [new file with mode: 0755]