Uses the URI.join to determine the redirection URL - Fix #829

This commit is contained in:
erwanlr
2015-06-18 20:48:43 +01:00
parent ac3409e376
commit 14115761f9
3 changed files with 17 additions and 6 deletions

View File

@@ -54,10 +54,7 @@ class WebSite
redirected_uri = URI.parse(add_trailing_slash(add_http_protocol(url)))
if response.code == 301 || response.code == 302
redirection = response.headers_hash['location']
if redirection[0] == '/'
redirection = "#{redirected_uri.scheme}://#{redirected_uri.host}#{redirection}"
end
redirection = redirected_uri.merge(response.headers_hash['location']).to_s
return redirection if url == redirection # prevents infinite loop