From a565c60c9bee10b3fe9cf5a5f69ef30d0ffb5f40 Mon Sep 17 00:00:00 2001 From: Darren Hicks Date: Sat, 23 Mar 2013 16:30:08 -0600 Subject: [PATCH] If a redirect is returned w/o scheme and host, then use the scheme, host and port of the most recent request --- lib/linkser/parser.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linkser/parser.rb b/lib/linkser/parser.rb index c7fd53d..b9a2d7b 100644 --- a/lib/linkser/parser.rb +++ b/lib/linkser/parser.rb @@ -7,7 +7,6 @@ class Parser def initialize url, options={} head = get_head url, options - @object = case head.content_type when "text/html" @@ -41,6 +40,7 @@ def get_head url, options, limit = 10 return response when Net::HTTPRedirection then location = response['location'] + location = "#{uri.scheme}://#{uri.host}:#{uri.port}#{location}" if location.start_with?("/") warn "Redirecting to #{location}" return get_head location, options, limit - 1 else