From 174a5e8b033e254fb70ffa5a6edb1918a0776342 Mon Sep 17 00:00:00 2001 From: Paul Morton Date: Thu, 11 Oct 2012 12:09:38 -0700 Subject: [PATCH] Sometimes ruby does some sweet stuff like converting line ending one text files (windows). In some cases this is a bad thing because it corrupts binary data (say ZIPs,PNGs, and the like). We should be able to tell ruby to _STOP_ being sweet. --- lib/nestful/request.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/nestful/request.rb b/lib/nestful/request.rb index bfc1484..288127c 100644 --- a/lib/nestful/request.rb +++ b/lib/nestful/request.rb @@ -7,7 +7,7 @@ def self.callbacks(type = nil) #:nodoc: end attr_reader :options, :format, :url - attr_accessor :params, :body, :buffer, :method, :headers, :callbacks, :raw, :extension + attr_accessor :params, :body, :buffer, :method, :headers, :callbacks, :raw, :extension, :buffer_binmode # Connection options attr_accessor :proxy, :user, :password, :auth_type, :timeout, :ssl_options @@ -115,6 +115,7 @@ def encoded def decoded(result) if buffer data = Tempfile.new("nfr.#{rand(1000)}") + data.binmode if buffer_binmode size = 0 total = result.content_length