lib/sitediff/crawler.rb in sitediff-1.2.0 vs lib/sitediff/crawler.rb in sitediff-1.2.1

- old
+ new

@@ -32,20 +32,20 @@ @found = Set.new @callback = block @curl_opts = curl_opts @debug = debug - add_uri('', depth) + add_uri('', depth, referrer: '/') end # Handle a newly found relative URI - def add_uri(rel, depth) + def add_uri(rel, depth, referrer = '') return if @found.include? rel @found << rel - wrapper = UriWrapper.new(@base + rel, @curl_opts, debug: @debug) + wrapper = UriWrapper.new(@base + rel, @curl_opts, debug: @debug, referrer: referrer) wrapper.queue(@hydra) do |res| fetched_uri(rel, depth, res) end end @@ -88,10 +88,10 @@ # Queue them in turn rels.each do |r| next if @found.include? r - add_uri(r, depth - 1) + add_uri(r, depth - 1, rel) end end # Resolve a potentially-relative link. Return nil on error. def resolve_link(base, rel)