From 5940bdaa6d672e0636d03c9d34173c7caba85df9 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Mon, 2 Oct 2017 17:46:53 +0200 Subject: [PATCH] Refuse connection requests with more than three "via" stations. --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 1c0a7bf..0a3f0c5 100644 --- a/main.py +++ b/main.py @@ -82,7 +82,7 @@ def application(env, re): except: re("400 Bad Request", []) yield "

400 Bad Request

".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 "

400 Bad Request

".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 "

400 Bad Request

".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: