From 9a664f7b3b6a5315983317b0e47128b809bc5531 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 29 Feb 2020 19:01:45 +0100 Subject: Refactored XSS filter into an asynchronous worker to better handle DOS attempts. --- src/lib/Timing.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/Timing.js') diff --git a/src/lib/Timing.js b/src/lib/Timing.js index 997ebd3..dd4fa06 100644 --- a/src/lib/Timing.js +++ b/src/lib/Timing.js @@ -15,7 +15,7 @@ class Timing { } async pause() { - if (this.interrupted) throw new TimingException("Interrupted"); + if (this.interrupted) throw new TimingException("Timing: interrupted"); let now = Date.now(); this.calls++; let sinceLastCall = now - this.lastCall; @@ -28,7 +28,7 @@ class Timing { if (now - this.lastPause > this.workSlot || this.calls > this.maxCalls) { this.tooLong = this.elapsed >= this.longTime; if (this.tooLong && this.fatalTimeout) { - throw new TimingException(`Exceeded ${this.longTime}ms timeout`); + throw new TimingException(`Timing: exceeded ${this.longTime}ms timeout`); } this.calls = 0; await Timing.sleep(this.pauseTime); -- cgit v1.2.3