lib/arachni/spider.rb in arachni-0.4.1.2 vs lib/arachni/spider.rb in arachni-0.4.1.3
- old
+ new
@@ -256,13 +256,15 @@
def skip?( url )
visited?( url ) || skip_path?( url )
end
def remove_path_params( url )
- uri = URI( url ).dup
+ uri = ::Arachni::URI( url ).dup
uri.path = uri.path.split( ';' ).first.to_s
uri.to_s
+ rescue
+ nil
end
#
# @param [String] url
#
@@ -322,11 +324,11 @@
def wait_if_paused
::IO::select( nil, nil, nil, 1 ) while( paused? )
end
def hit_redirect_limit?
- @opts.redirect_limit > 0 && @opts.redirect_limit >= @followed_redirects
+ @opts.redirect_limit > 0 && @opts.redirect_limit <= @followed_redirects
end
def visit( url, opts = {}, &block )
return if skip?( url ) || redundant?( url ) || auto_redundant?( url )
visited( url )
@@ -343,15 +345,16 @@
wrap = proc do |res|
effective_url = normalize_url( res.effective_url )
if res.redirection?
@redirects << res.request.url
- if hit_redirect_limit? || skip?( res.location )
+ location = to_absolute( res.location )
+ if hit_redirect_limit? || skip?( location )
decrease_pending
next
end
@followed_redirects += 1
- push res.location
+ push location
end
print_status( "[HTTP: #{res.code}] " + effective_url )
@sitemap[effective_url] = res.code
block.call( res )