Skip to content

Commit

Permalink
Merge pull request #32 from pineman/max_redirects-default-document
Browse files Browse the repository at this point in the history
Apply default to :max_redirects option and document
  • Loading branch information
hsbt authored Jul 11, 2024
2 parents aec6928 + 4a247e5 commit 7ccc67c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/open-uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def OpenURI.open_loop(uri, options) # :nodoc:
end

uri_set = {}
max_redirects = options[:max_redirects]
max_redirects = options[:max_redirects] || Options.fetch(:max_redirects)
buf = nil
while true
redirect = catch(:open_uri_redirect) {
Expand Down Expand Up @@ -746,6 +746,12 @@ module OpenRead
# Using +true+ also means that redirections between http and ftp are
# permitted.
#
# [:max_redirects]
# Synopsis:
# :max_redirects=>int
#
# Number of HTTP redirects allowed before OpenURI::TooManyRedirects is raised.
# The default is 64.
def open(*rest, &block)
OpenURI.open_uri(self, *rest, &block)
end
Expand Down

0 comments on commit 7ccc67c

Please sign in to comment.