about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/unicorn/app/exec_cgi.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index d98b3e4..2c71df9 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -95,8 +95,9 @@ module Unicorn::App
       # Allows +out+ to be used as a Rack body.
       def out.each
         sysseek(@unicorn_app_exec_cgi_offset)
+        buf = ''
         begin
-          loop { yield(sysread(CHUNK_SIZE)) }
+          loop { yield(sysread(CHUNK_SIZE, buf)) }
         rescue EOFError
         end
       end
@@ -126,7 +127,8 @@ module Unicorn::App
         tmp.binmode
 
         # Rack::Lint::InputWrapper doesn't allow sysread :(
-        while buf = inp.read(CHUNK_SIZE)
+        buf = ''
+        while inp.read(CHUNK_SIZE, buf)
           tmp.syswrite(buf)
         end
         tmp.sysseek(0)