class PhisherPhinder::HostResponsePolicy

Public Instance Methods

next_url(url, response) click to toggle source
# File lib/phisher_phinder/host_response_policy.rb, line 5
def next_url(url, response)
  location_header = response.headers['Location']

  if [301, 302, 303, 307, 308].include?(response.status) && location_header && !location_header.empty?
    if response.headers['Location'] =~ %r{\A/}
      url.merge(response.headers['Location'])
    else
      URI.parse(response.headers['Location'])
    end
  end
end