Skip to content

Commit

Permalink
Merge 1b163c4 into d89912b
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinjiTanimoto committed Apr 14, 2020
2 parents d89912b + 1b163c4 commit b0a05f6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/controllers/cms/agents/tasks/links_controller.rb
Expand Up @@ -195,8 +195,8 @@ def get_internal_file(url)
# Returns the HTML response with HTTP request.
def get_http(url)
http_basic_authentication = SS::MessageEncryptor.http_basic_authentication
count = 0
max_count = 2
redirect_urls = []
max_count = 10

if url.match?(/^\/\//)
url = @base_url.sub(/\/\/.*$/, url)
Expand All @@ -213,8 +213,9 @@ def get_http(url)
return data.join
end
rescue OpenURI::HTTPRedirect => e
return if count >= max_count
count += 1
return if redirect_urls.size >= max_count
return if redirect_urls.index(e.uri)
redirect_urls << e.uri
url = e.uri
retry
rescue Timeout::Error
Expand Down

0 comments on commit b0a05f6

Please sign in to comment.