diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-09-27 20:48:20 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-09-27 20:48:20 -0700 |
commit | 79c270990ec3a657c23510ee4f2f7f2b4c2c748f (patch) | |
tree | e760846dc5446b4a903cd7c7c8c6756fac8f6b54 /lib/unicorn/tee_input.rb | |
parent | 3b0fcbf8baafbb88b2f15631b949fde9c8acff3b (diff) | |
download | unicorn-79c270990ec3a657c23510ee4f2f7f2b4c2c748f.tar.gz |
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...)
Diffstat (limited to 'lib/unicorn/tee_input.rb')
-rw-r--r-- | lib/unicorn/tee_input.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb index 36a76ed..96a053a 100644 --- a/lib/unicorn/tee_input.rb +++ b/lib/unicorn/tee_input.rb @@ -15,7 +15,7 @@ module Unicorn def initialize(*args) super(*args) @size = parser.content_length - @tmp = @size && @size < Const::MAX_BODY ? StringIO.new(Z.dup) : Util.tmpio + @tmp = @size && @size < Const::MAX_BODY ? StringIO.new("") : Util.tmpio @buf2 = buf.dup if buf.size > 0 parser.filter_body(@buf2, buf) and finalize_input @@ -46,7 +46,7 @@ module Unicorn length = args.shift if nil == length - rv = @tmp.read || Z.dup + rv = @tmp.read || "" while tee(Const::CHUNK_SIZE, @buf2) rv << @buf2 end |