From b1e30bc2a717275e54d94b2d2826fec747a170e5 Mon Sep 17 00:00:00 2001 From: Reid Vandewiele Date: Sun, 12 Sep 2021 19:37:27 -0700 Subject: [PATCH] Remove opt, add comment to R10K::Tarball#http_get We aren't doing anything besides Get, so just hard-code it for ease of understanding. The comment clarifies what this method does, and how it is used by consuming methods. --- lib/r10k/tarball.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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]