diff --git a/lib/mini_portile2/mini_portile.rb b/lib/mini_portile2/mini_portile.rb index 5bd9052..393ea81 100644 --- a/lib/mini_portile2/mini_portile.rb +++ b/lib/mini_portile2/mini_portile.rb @@ -473,7 +473,6 @@ def download_file(url, full_path, count = 3) def download_file_http(url, full_path, count = 3) filename = File.basename(full_path) with_tempfile(filename, full_path) do |temp_file| - progress = 0 total = 0 params = { "Accept-Encoding" => 'identity', @@ -482,7 +481,6 @@ def download_file_http(url, full_path, count = 3) if total new_progress = (bytes * 100) / total message "\rDownloading %s (%3d%%) " % [filename, new_progress] - progress = new_progress else # Content-Length is unavailable because Transfer-Encoding is chunked message "\rDownloading %s " % [filename] @@ -532,14 +530,12 @@ def download_file_file(uri, full_path) def download_file_ftp(uri, full_path) filename = File.basename(uri.path) with_tempfile(filename, full_path) do |temp_file| - progress = 0 total = 0 params = { :content_length_proc => lambda{|length| total = length }, :progress_proc => lambda{|bytes| new_progress = (bytes * 100) / total message "\rDownloading %s (%3d%%) " % [filename, new_progress] - progress = new_progress } } if ENV["ftp_proxy"]