Permalink
Browse files

Typhoeus converts the headers into arrays when redirected so instead …

…of the location header use the effective_url [Closes #202]
  • Loading branch information...
1 parent 4097ca8 commit 26657779944f0d9674742665c1013328407394ae @Zapotek Zapotek committed Jun 22, 2012
Showing with 14 additions and 1 deletion.
  1. +1 −1 lib/arachni/spider.rb
  2. +9 −0 spec/arachni/spider_spec.rb
  3. +4 −0 spec/servers/arachni/spider.rb
View
@@ -309,7 +309,7 @@ def visit( url, opts = {}, &block )
effective_url = normalize_url( res.effective_url )
if res.redirection?
@redirects << res.request.url
- next if skip?( res.location )
+ next if skip?( effective_url )
end
print_status( "[HTTP: #{res.code}] " + effective_url )
@@ -146,6 +146,15 @@
pages.first.is_a?( Arachni::Parser::Page ).should be_true
end
end
+ context 'when a redirect that is outside the scope is encountered' do
+ it 'should be ignored' do
+ @opts.url = @url + '/skip_redirect'
+
+ spider = Arachni::Spider.new
+ spider.run.should be_empty
+ spider.redirects.size.should == 1
+ end
+ end
context 'when called with options and a block' do
describe :pass_pages_to_block do
describe true do
@@ -12,6 +12,10 @@
redirect '/'
end
+get '/skip_redirect' do
+ redirect 'http://google.com'
+end
+
get '/redundant' do
<<EOHTML
<a href='/redundant/1'>Redundant 1</a>

0 comments on commit 2665777

Please sign in to comment.