Adds tests for blocked server checks

This commit is contained in:
Mouse Reeve
2021-04-05 15:54:33 -07:00
parent 194fcb8055
commit 34b790a086
2 changed files with 27 additions and 0 deletions

View File

@ -68,6 +68,8 @@ def is_blocked_user_agent(request):
""" check if a request is from a blocked server based on user agent """
# check user agent
user_agent = request.headers.get("User-Agent")
if not user_agent:
return False
domain = re.match(regex.domain, user_agent)
if not domain:
# idk, we'll try again later with the actor