diff --git a/botfilter.go b/botfilter.go index 244391f2..c7197c91 100644 --- a/botfilter.go +++ b/botfilter.go @@ -52,3 +52,20 @@ func (b *botFilter) ServeHTTP(rw http.ResponseWriter, r *http.Request) { return } + match := inspectRequest(r, b.config) + paths := requestPaths(r) + decision := b.cache.observeRequest(ip, requestObservation{ + at: now, + paths: paths, + points: match.points, + forceBan: match.forceBan, + }) + if decision.banned { + reason := match.reason + if reason == "" { + reason = "suspicion score threshold" + } + b.reject(rw, ip, reason, decision) + return + } +