Alternative user agent

main
Bob Mottram 2021-09-02 10:07:49 +01:00
parent edeb0d9f1e
commit 243b4bc310
1 changed files with 5 additions and 0 deletions

View File

@ -497,8 +497,13 @@ class PubServer(BaseHTTPRequestHandler):
""" """
agentDomain = None agentDomain = None
agentStr = None agentStr = None
if self.headers.get('User-Agent'): if self.headers.get('User-Agent'):
agentStr = self.headers['User-Agent'] agentStr = self.headers['User-Agent']
elif self.headers.get('user-agent'):
agentStr = self.headers['user-agent']
if agentStr:
# is this a web crawler? If so the block it # is this a web crawler? If so the block it
agentStrLower = agentStr.lower() agentStrLower = agentStr.lower()
if 'bot/' in agentStrLower or 'bot-' in agentStrLower: if 'bot/' in agentStrLower or 'bot-' in agentStrLower: