about summary refs log tree commit homepage
path: root/lib/unicorn/app
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicorn/app')
-rw-r--r--lib/unicorn/app/exec_cgi.rb6
-rw-r--r--lib/unicorn/app/inetd.rb7
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index 4f9216b..2262e4c 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -125,10 +125,10 @@ module Unicorn::App
       else
         tmp = Unicorn::Util.tmpio
 
-        buf = Unicorn::Z.dup
-        while inp.read(CHUNK_SIZE, buf)
+        buf = inp.read(CHUNK_SIZE)
+        begin
           tmp.syswrite(buf)
-        end
+        end while inp.read(CHUNK_SIZE, buf)
         tmp.sysseek(0)
         tmp
       end
diff --git a/lib/unicorn/app/inetd.rb b/lib/unicorn/app/inetd.rb
index f751a33..9bfa7cb 100644
--- a/lib/unicorn/app/inetd.rb
+++ b/lib/unicorn/app/inetd.rb
@@ -33,13 +33,12 @@ module Unicorn::App
         inp_pid = fork {
           input = env['rack.input']
           [ err_rd, out_rd ].each { |io| io.close }
-          buf = Unicorn::Z.dup
 
           # this is dependent on input.read having readpartial semantics:
-          while input.read(16384, buf)
+          buf = input.read(16384)
+          begin
             in_wr.write(buf)
-          end
-          in_wr.close
+          end while input.read(16384, buf)
         }
         in_wr.close
         self.pid_map = {