From 013fb6cffd4437b80466d428d7021925d105774c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 10 Dec 2021 15:59:46 +0000 Subject: [PATCH] Make post user agent checking subject to busy flag --- daemon.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index c91442755..b0cf0155e 100644 --- a/daemon.py +++ b/daemon.py @@ -17420,12 +17420,6 @@ class PubServer(BaseHTTPRequestHandler): self._400() return - uaStr = self._getUserAgent() - - if self._blockedUserAgent(callingDomain, uaStr): - self._400() - return - currTimePOST = int(time.time() * 1000) if self.server.POSTbusy: if currTimePOST - self.server.lastPOST < 500: @@ -17435,6 +17429,13 @@ class PubServer(BaseHTTPRequestHandler): self.server.POSTbusy = True self.server.lastPOST = currTimePOST + uaStr = self._getUserAgent() + + if self._blockedUserAgent(callingDomain, uaStr): + self._400() + self.server.POSTbusy = False + return + if not self.headers.get('Content-type'): print('Content-type header missing') self._400()