Skip to content

Commit

Permalink
retry on form parsing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed Nov 28, 2019
1 parent 35d1141 commit 0e658ba
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions w3af/plugins/auth/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,21 @@ def _get_login_form(self):
self._log_error(msg % args)

#
# Set the attempt_login to false, in order to prevent the plugin from
# running again.
# We get here when:
#
# This is done in this case because we can't recover from it: got the
# HTML and it has no login forms. Other cases such as HTTP timeouts
# in the request to get the HTML might work in a retry
# * The user configured the login form URL incorrectly
#
# * There is an error in the HTTP request, and the HTTP response
# does NOT contain the login form.
#
# It is impossible to know in which case we are in, so we just return
# None and wait for the next call to login(). The next call will act
# as the retry strategy for the potential HTTP request / response error
#
# In the past we were setting self._attempt_login = False here, but
# any errors (timeouts!) in the HTTP request to get the form ended
# up in an ugly situation where the plugin was disabled
#
self._attempt_login = False
return None

msg = 'Login form with action %s found in HTTP response with ID %s'
Expand Down

0 comments on commit 0e658ba

Please sign in to comment.