diff --git a/main.py b/main.py
index cf0a82a..1ab4864 100644
--- a/main.py
+++ b/main.py
@@ -15,8 +15,33 @@ def application(env, re):
re("405 Method Not Allowed", [])
return
+ conn = False
+ val = False
+ cfrm = None
+ cto = None
+
+ split = env["PATH_INFO"].split("/")
+
+ while "" in split:
+ split.remove("")
+
+ if len(split) > 2:
+ re("400 Bad Request", [])
+ yield "
400 Bad Request
".encode()
+ yield "Only one (validate) or two (conn) arguments may be passed as path."
+ return
+
+ if len(split) > 0:
+ if len(split) == 1:
+ val = True
+ else:
+ conn = True
+ cto = split[1]
+
+ cfrm = split[0]
+
try:
- rtype = args["type"][0]
+ rtype = "conn" if conn else "val" if val else args["type"][0]
except:
re("400 Bad Request", [])
yield "400 Bad Request
".encode()
@@ -27,8 +52,8 @@ def application(env, re):
if rtype.lower() in ["conn", "connection"]:
try:
- frm = args["from"][0]
- to = args["to"][0]
+ frm = cfrm or args["from"][0]
+ to = cto or args["to"][0]
if not frm or not to:
raise ValueError()
@@ -78,7 +103,7 @@ def application(env, re):
elif rtype.lower() in ["val", "validate"]:
try:
- name = args["name"]
+ name = cfrm or args["name"]
if not name:
raise ValueError()