Add limit for post (draw pixels)

main
t 1 year ago
parent 19eadd9d81
commit 05d983dae3

@ -71,12 +71,17 @@ class RequestHandler(BaseHTTPRequestHandler):
content_length = int(self.headers['Content-Length']) content_length = int(self.headers['Content-Length'])
body = self.rfile.read(content_length) body = self.rfile.read(content_length)
params = parse_qs(body.decode('utf-8'))["main"] params = parse_qs(body.decode('utf-8'))["main"][0]
ic(params) ic(params)
#Set limit pixels for 1 response
ic(len(params))
if len(params) > 5685:
return 0
matrix = self.get_matrix() matrix = self.get_matrix()
ll = unpack(params[0]) ll = unpack(params)
for i in ll: for i in ll:
x = i[1] ; y = i[0] #Fix (y, x) -> (x, y) on server side x = i[1] ; y = i[0] #Fix (y, x) -> (x, y) on server side
matrix[x, y] = [i[2], i[3], i[4]] matrix[x, y] = [i[2], i[3], i[4]]

Loading…
Cancel
Save