Skip to content

Commit

Permalink
Process triggers and notifications also on exception during ActiveSca…
Browse files Browse the repository at this point in the history
…ns sendAndReceive. Fixes zaproxy#7004

Signed-off-by: Dennis Kniep <kniepdennis@gmail.com>
  • Loading branch information
denniskniep committed Jan 4, 2022
1 parent 0e49dcb commit 8808e34
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
// ZAP: 2020/11/17 Use new TechSet#getAllTech().
// ZAP: 2020/11/26 Use Log4j2 getLogger() and deprecate Log4j1.x.
// ZAP: 2021/07/20 Correct message updated with the scan rule ID header (Issue 6689).
// ZAP: 2022/01/04 Process triggers and notifications also on exception during sendAndReceive (Issue
// 7004).
package org.parosproxy.paros.core.scanner;

import java.io.IOException;
Expand Down Expand Up @@ -309,17 +311,21 @@ protected void sendAndReceive(
// ZAP: Runs the "beforeScan" methods of any ScannerHooks
parent.performScannerHookBeforeScan(message, this);

if (isFollowRedirect) {
parent.getHttpSender().sendAndReceive(message, getParent().getRedirectRequestConfig());
} else {
parent.getHttpSender().sendAndReceive(message, false);
}

// ZAP: Notify parent
parent.notifyNewMessage(this, message);
try {
if (isFollowRedirect) {
parent.getHttpSender()
.sendAndReceive(message, getParent().getRedirectRequestConfig());
} else {
parent.getHttpSender().sendAndReceive(message, false);
}
} finally {
// ZAP: Notify parent
parent.notifyNewMessage(this, message);

// ZAP: Set the history reference back and run the "afterScan" methods of any ScannerHooks
parent.performScannerHookAfterScan(message, this);
// ZAP: Set the history reference back and run the "afterScan" methods of any
// ScannerHooks
parent.performScannerHookAfterScan(message, this);
}
}

@Override
Expand Down

0 comments on commit 8808e34

Please sign in to comment.