diff --git a/matcher.go b/matcher.go index 4179e366..f83abcfa 100644 --- a/matcher.go +++ b/matcher.go @@ -34,3 +34,19 @@ func inspectRequest(r *http.Request, cfg *compiledConfig) matchResult { return matchResult{points: cfg.BadPathScore, forceBan: true, reason: "blocked extension"} } + result := matchResult{} + if userAgent == "" { + result.points += cfg.EmptyUserAgentScore + result.reason = "empty user-agent" + } + if !hasHeader(r, "Accept") { + result.points += cfg.MissingAcceptScore + result.reason = appendReason(result.reason, "missing accept") + } + if cfg.BrowserValidation && implausibleBrowser(r, userAgent) { + result.points += cfg.FakeBrowserScore + result.reason = appendReason(result.reason, "implausible browser headers") + } + return result +} +