diff --git a/lib/vagrant/util/downloader.rb b/lib/vagrant/util/downloader.rb index 285f83b75..142045b79 100644 --- a/lib/vagrant/util/downloader.rb +++ b/lib/vagrant/util/downloader.rb @@ -107,16 +107,19 @@ module Vagrant if progress_data.include?("Location") location = progress_data.scan(/Location: (.+?)$/m).flatten.compact.first.to_s.strip if !location.empty? - @logger.info("download redirected to #{location}") location_uri = URI.parse(location) - source_uri = URI.parse(source) - source_host = source_uri.host.split(".", 2).last - location_host = location_uri.host.split(".", 2).last - if !@redirect_notify && location_host != source_host && !SILENCED_HOSTS.include?(location_host) - @ui.clear_line - @ui.detail "Download redirected to host: #{location_uri.host}" + + unless location_uri.host.nil? + @logger.info("download redirected to #{location}") + source_uri = URI.parse(source) + source_host = source_uri.host.split(".", 2).last + location_host = location_uri.host.split(".", 2).last + if !@redirect_notify && location_host != source_host && !SILENCED_HOSTS.include?(location_host) + @ui.clear_line + @ui.detail "Download redirected to host: #{location_uri.host}" + end + @redirect_notify = true end - @redirect_notify = true end progress_data.replace("") break