about summary refs log tree commit homepage
path: root/lib/unicorn/tee_input.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unicorn/tee_input.rb')
-rw-r--r--lib/unicorn/tee_input.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index 8ff7258..563747c 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -109,7 +109,7 @@ module Unicorn
     # unlike IO#gets.
     def gets
       socket or return tmp.gets
-      nil == $/ and return read
+      sep = $/ or return read
 
       orig_size = tmp.size
       if tmp.pos == orig_size
@@ -117,8 +117,9 @@ module Unicorn
         tmp.seek(orig_size)
       end
 
+      sep_size = Rack::Utils.bytesize(sep)
       line = tmp.gets # cannot be nil here since size > pos
-      $/ == line[-$/.size, $/.size] and return line
+      sep == line[-sep_size, sep_size] and return line
 
       # unlikely, if we got here, then tmp is at EOF
       begin
@@ -126,7 +127,7 @@ module Unicorn
         tee(Const::CHUNK_SIZE, buf2) or break
         tmp.seek(orig_size)
         line << tmp.gets
-        $/ == line[-$/.size, $/.size] and return line
+        sep == line[-sep_size, sep_size] and return line
         # tmp is at EOF again here, retry the loop
       end while true