Skip to content

Commit

Permalink
Redirect a maximum of 5 times instead of time limit, closes teamcapyb…
Browse files Browse the repository at this point in the history
…ara#67

This is as per http://www.ietf.org/rfc/rfc2068.txt

"A user agent SHOULD NOT automatically redirect a request
more than 5 times, since such redirections usually indicate an
infinite loop."
  • Loading branch information
jnicklas committed Jun 29, 2010
1 parent d72d999 commit 2e6745e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/capybara/driver/rack_test_driver.rb
Expand Up @@ -249,10 +249,8 @@ def current_path
end

def follow_redirects!
Capybara::WaitUntil.timeout(4) do
redirect = response.redirect?
follow_redirect! if redirect
not redirect
5.times do
follow_redirect! if response.redirect?
end
rescue Capybara::TimeoutError
raise Capybara::InfiniteRedirectError, "infinite redirect detected!"
Expand Down

0 comments on commit 2e6745e

Please sign in to comment.