From 17a734a9f6ccea8c969a574f09b5d8dd3d568a9c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 13 Nov 2010 16:41:10 +0800 Subject: tee_input: restore read position after #size It's possible for an application to call size after it has read a few bytes/lines, so do not screw up a user's read offset when consuming input. --- lib/unicorn/tee_input.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb index 0e937ff..ee3effd 100644 --- a/lib/unicorn/tee_input.rb +++ b/lib/unicorn/tee_input.rb @@ -43,8 +43,9 @@ class Unicorn::TeeInput < Unicorn::StreamInput # specified +length+ in a loop until it returns +nil+. def size @len and return @len + pos = @bytes_read consume! - @tmp.rewind + @tmp.pos = pos @len = @bytes_read end -- cgit v1.2.3-24-ge0c7