Skip to content

Commit

Permalink
Remove opt, add comment to R10K::Tarball#http_get
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
reidmv committed Sep 13, 2021
1 parent e41aa2b commit b1e30bc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/r10k/tarball.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit b1e30bc

Please sign in to comment.