Permalink
Browse files

Do not fetch the same link twice

If a page lists a link more than once, or links to itself, don't fetch
more than once.
  • Loading branch information...
1 parent 782f612 commit f68bca1baf6d19249e179357591a9b0d7a23ff76 @singpolyma committed Oct 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/relparser.rb
View
@@ -11,6 +11,7 @@ def initialize(opts={})
# Normalize
@meURI.scheme = "http" if @meURI.scheme == "https"
@meURI.path = "/" if @meURI.path == ""
+ @meURI.normalize!
end
def agent
@@ -40,7 +41,7 @@ def get(tag)
@page.links.each do |link|
links << link.href if link.rel?("me")
end
- links
+ links.map {|u| URI::parse(u).normalize}.uniq.reject {|u| u == @meURI}.map(&:to_s)
end
def rel_me_links

0 comments on commit f68bca1

Please sign in to comment.