Skip to content

Commit

Permalink
[api] ruby 1.9 needs it differently ;(
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Mar 31, 2012
1 parent 5f163b9 commit 17bca8c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/api/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,12 @@ def forward_from_backend(path)
backend_http = Net::HTTP.new(CONFIG['source_host'], CONFIG['source_port'])
backend_http.read_timeout = 1000

file = Tempfile.new 'volley', :encoding => 'ascii-8bit'
if RUBY_VERSION < '1.9'
file = Tempfile.new 'volley'
else
file = Tempfile.new 'volley', :encoding => 'ascii-8bit'
end

opts = { :url_based_filename => true }

backend_http.request_get(path) do |res|
Expand All @@ -364,7 +369,11 @@ def forward_from_backend(path)

hide_action :download_request
def download_request
file = Tempfile.new 'volley', :encoding => 'ascii-8bit'
if RUBY_VERSION < '1.9'
file = Tempfile.new 'volley'
else
file = Tempfile.new 'volley', :encoding => 'ascii-8bit'
end
b = request.body
buffer = String.new
while b.read(40960, buffer)
Expand Down

0 comments on commit 17bca8c

Please sign in to comment.