feat(botfilter): matcher.go part 2/5
This commit is contained in:
1 parent
cecaea6256
commit
8818694d21
1 file changed
+16
+16
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user