[interchange] Correct logging of bad robot to permit rerouting with ErrorDestination,
Josh Lavin <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit ca82c6ee4e8accdd8811b03718dceb960f236c0e Author: Josh Lavin <[email protected]> Date: Thu Jul 10 11:27:32 2014 -0700 Correct logging of bad robot to permit rerouting with ErrorDestination, and to remove duplicate log message. lib/Vend/Error.pm | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) --- diff --git a/lib/Vend/Error.pm b/lib/Vend/Error.pm index 1d560ad..03f1bc2 100644 --- a/lib/Vend/Error.pm +++ b/lib/Vend/Error.pm @@ -186,25 +186,19 @@ sub do_lockout { # Now we log the error after custom lockout routine gets chance # to bypass my $pause = $::Limit->{lockout_reset_seconds} || 30; - $msg = errmsg( - "WARNING: POSSIBLE BAD ROBOT. %s accesses with no %d second pause.", - $Vend::Session->{accesses}, - $pause, - ); - ::logError($msg); + my $msg_string = "WARNING: POSSIBLE BAD ROBOT. %s accesses with no %d second pause."; + ::logError($msg_string, $Vend::Session->{accesses}, $pause); if($cmd = $Global::LockoutCommand) { my $host = $CGI::remote_addr; $cmd =~ s/%s/$host/ or $cmd .= " $host"; $msg .= errmsg("Performing lockout command '%s'", $cmd); system $cmd; - $msg .= errmsg("\nBad status %s from '%s': %s\n", $?, $cmd, $!) - if $?; + $? and $msg .= "\n" . errmsg("Bad status %s from '%s': %s\n", $?, $cmd, $!); logGlobal({level => 'notice'}, $msg); } $Vend::Cfg->{VendURL} = $Vend::Cfg->{SecureURL} = 'http://127.0.0.1'; $Vend::LockedOut = 1; - logError($msg) if $msg; return; }