Fix #112 Multiple redirections detection
This commit is contained in:
@@ -70,8 +70,9 @@ module WebSite
|
||||
@xmlrpc_url
|
||||
end
|
||||
|
||||
# see if the remote url returns 30x redirect
|
||||
# return a string with the redirection or nil
|
||||
# See if the remote url returns 30x redirect
|
||||
# This method is recursive
|
||||
# Return a string with the redirection or nil
|
||||
def redirection(url = nil)
|
||||
redirection = nil
|
||||
url ||= @uri.to_s
|
||||
@@ -79,6 +80,11 @@ module WebSite
|
||||
|
||||
if response.code == 301 || response.code == 302
|
||||
redirection = response.headers_hash['location']
|
||||
|
||||
# Let's check if there is a redirection in the redirection
|
||||
if other_redirection = redirection(redirection)
|
||||
redirection = other_redirection
|
||||
end
|
||||
end
|
||||
|
||||
redirection
|
||||
|
||||
Reference in New Issue
Block a user