Early blocking of domains

main
Bob Mottram 2020-03-27 11:46:36 +00:00
parent 4e2e1dab21
commit 279f6ece20
1 changed files with 16 additions and 0 deletions

View File

@ -915,6 +915,14 @@ class PubServer(BaseHTTPRequestHandler):
return locatePost(baseDir,nickname,domain,messageId),nickname
def do_GET(self):
callingDomain=None
if self.headers.get('Host'):
callingDomain=self.headers['Host']
if isBlockedDomain(self.server.baseDir,callingDomain):
print('GET domain blocked: '+callingDomain)
self._400()
return
GETstartTime=time.time()
GETtimings=[]
@ -4282,6 +4290,14 @@ class PubServer(BaseHTTPRequestHandler):
return
self.server.lastPOST=currTimePOST
callingDomain=None
if self.headers.get('Host'):
callingDomain=self.headers['Host']
if isBlockedDomain(self.server.baseDir,callingDomain):
print('POST domain blocked: '+callingDomain)
self._400()
return
self.server.POSTbusy=True
if not self.headers.get('Content-type'):
print('Content-type header missing')