summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-19 17:17:32 -0700
committerEric Wong <normalperson@yhbt.net>2009-07-19 17:18:59 -0700
commit7bcfcde9f9bfed2ecd666869e4adb71ee1861ced (patch)
tree6e3dc3a6b0fa09f4cda60ce234ab90e9f438b640
parent864a25c20b1b7d785cdff20f99e4246e7a7f9a93 (diff)
"/dev/null" must be opened in binary mode for Rack-compliance.
Additionally, avoid '' to create an empty string and use
Unicorn::Z instead.
-rw-r--r--lib/unicorn/app/exec_cgi.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/unicorn/app/exec_cgi.rb b/lib/unicorn/app/exec_cgi.rb
index b0fbedc..861d5e6 100644
--- a/lib/unicorn/app/exec_cgi.rb
+++ b/lib/unicorn/app/exec_cgi.rb
@@ -121,12 +121,12 @@ module Unicorn::App
       if inp.respond_to?(:fileno) && Integer === inp.fileno
         inp
       elsif inp.size == 0 # inp could be a StringIO or StringIO-like object
-        ::File.open('/dev/null')
+        ::File.open('/dev/null', 'rb')
       else
         tmp = Unicorn::Util.tmpio
 
         # Rack::Lint::InputWrapper doesn't allow sysread :(
-        buf = ''
+        buf = Unicorn::Z.dup
         while inp.read(CHUNK_SIZE, buf)
           tmp.syswrite(buf)
         end