# File src/ruby_supportlib/phusion_passenger/utils/download.rb, line 64
      def download(url, output, options = {})
        options = {
          :connect_timeout => 4,
          :idle_timeout    => 5
        }.merge(options)
        logger = options[:logger] || Logger.new(STDERR)

        if options[:use_cache] && cache_dir = PhusionPassenger.download_cache_dir
          basename = basename_from_url(url)
          if File.exist?("#{cache_dir}/#{basename}")
            logger.info "Copying #{basename} from #{cache_dir}..."
            FileUtils.cp("#{cache_dir}/#{basename}", output)
            return true
          end
        end

        if PlatformInfo.find_command("curl")
          return download_with_curl(logger, url, output, options)
        elsif PlatformInfo.find_command("wget")
          return download_with_wget(logger, url, output, options)
        else
          logger.error "Could not download #{url}: no download tool found (curl or wget required)"
          return false
        end
      end