diff --git a/lib/r10k/tarball.rb b/lib/r10k/tarball.rb index 777ad68a9..1f5c15c3a 100644 --- a/lib/r10k/tarball.rb +++ b/lib/r10k/tarball.rb @@ -196,9 +196,12 @@ def reader_digest(reader) digest.hexdigest end - def http_get(uri, method: Net::HTTP::Get, redirect_limit: 10, &block) + # Start a Net::HTTP::Get connection, then yield the Net::HTTPSuccess object + # to the caller's block. Follow redirects if Net::HTTPRedirection responses + # are encountered, and honor settings[:proxy]. + def http_get(uri, redirect_limit: 10, &block) raise "HTTP redirect too deep" if redirect_limit.zero? - request = method.new(uri) + request = Net::HTTP::Get(uri) connection = Net::HTTP.new(uri.host, uri.port) proxy = if settings[:proxy]