Skip to content

Commit

Permalink
If a redirect is returned w/o scheme and host, then use the scheme, h…
Browse files Browse the repository at this point in the history
…ost and port of the most recent request
  • Loading branch information
deevis committed Mar 23, 2013
1 parent 14d0aa8 commit a565c60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/linkser/parser.rb
Expand Up @@ -7,7 +7,6 @@ class Parser

def initialize url, options={}
head = get_head url, options

@object =
case head.content_type
when "text/html"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a565c60

Please sign in to comment.