summary refs log tree commit
diff options
context:
space:
mode:
authorHongli Lai (Phusion) <hongli@phusion.nl>2009-06-17 17:30:38 -0500
committerJoshua Peek <josh@joshpeek.com>2009-06-17 17:30:38 -0500
commit6df2248be0b323124cb491fa2f89b6b82f539f32 (patch)
tree77d9a7959b111dd88f0750c97eccc4d6e496f71f
parent07c18145496fe1833b20d31856f70a2bc50db18b (diff)
downloadrack-6df2248be0b323124cb491fa2f89b6b82f539f32.tar.gz
Enforce binary encoding in RewindableInput; fixes Ruby 1.9 issues.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
-rw-r--r--lib/rack/rewindable_input.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/rack/rewindable_input.rb b/lib/rack/rewindable_input.rb
index 9e9b21ff..accd96be 100644
--- a/lib/rack/rewindable_input.rb
+++ b/lib/rack/rewindable_input.rb
@@ -72,6 +72,8 @@ module Rack
       # access it because we have the file handle open.
       @rewindable_io = Tempfile.new('RackRewindableInput')
       @rewindable_io.chmod(0000)
+      @rewindable_io.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding)
+      @rewindable_io.binmode
       if filesystem_has_posix_semantics?
         @rewindable_io.unlink
         @unlinked = true