Debugging unknown posts

master
Bob Mottram 2019-08-14 23:33:55 +01:00
parent d532882972
commit 15a43eed2a
1 changed files with 6 additions and 0 deletions

View File

@ -2583,6 +2583,12 @@ class PubServer(BaseHTTPRequestHandler):
# refuse to receive non-json content # refuse to receive non-json content
if self.headers['Content-type'] != 'application/json': if self.headers['Content-type'] != 'application/json':
print("POST is not json: "+self.headers['Content-type']) print("POST is not json: "+self.headers['Content-type'])
if self.server.debug:
print(str(self.headers))
length = int(self.headers['Content-length'])
if length<self.server.maxPostLength:
unknownPost=self.rfile.read(length).decode('utf-8')
print(str(unknownPost))
self.send_response(400) self.send_response(400)
self.end_headers() self.end_headers()
self.server.POSTbusy=False self.server.POSTbusy=False