Refuse connection requests with more than three "via" stations.

This commit is contained in:
Klaus-Uwe Mitterer 2017-10-02 17:46:53 +02:00
parent 479bc58489
commit 5940bdaa6d

10
main.py
View file

@ -82,7 +82,7 @@ def application(env, re):
except:
re("400 Bad Request", [])
yield "<h1>400 Bad Request</h1>".encode()
yield "The \"count\" value must be a value between 0 and 10."
yield "The \"count\" value must be a value between 0 and 10.".encode()
return
try:
@ -90,11 +90,17 @@ def application(env, re):
except:
re("400 Bad Request", [])
yield "<h1>400 Bad Request</h1>".encode()
yield "The \"date\" value must be in DD.MM.YYYY format, the \"time\" value must be in HH:MM format."
yield "The \"date\" value must be in DD.MM.YYYY format, the \"time\" value must be in HH:MM format.".encode()
return
via = list(args["via"]) if "via" in args else None
if via and len(via) > 3:
re("400 Bad Request", [])
yield "<h1>400 Bad Request</h1>".encode()
yield "It is not possible to route through more than three \"via\" stations.".encode()
return
try:
output = workers.conn.worker(frm, to, count, outtime, mode, details, json, via)
except Exception as e: