From 79c270990ec3a657c23510ee4f2f7f2b4c2c748f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 27 Sep 2009 20:48:20 -0700 Subject: Remove "Z" constant for binary strings We've started using magic comments to ensure any strings we create are binary instead. Additionally, ensure we create any StringIO objects with an explicit string (which default to binary) to ensure the StringIO object is binary. This is because StringIO.new (with no arguments) will always use the process-wide default encoding since it does not know about magic comments (and couldn't, really...) --- lib/unicorn/app/inetd.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/unicorn/app/inetd.rb') 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 = { -- cgit v1.2.3-24-ge0c7